-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/array padding #3977
Feat/array padding #3977
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -524,6 +524,44 @@ void unhex(StringRef *str, StringRef *output, bool* is_null); | |
void printLog(const char* fmt); | ||
void array_combine(codec::StringRef *del, int32_t cnt, ArrayRef<codec::StringRef> **data, | ||
ArrayRef<codec::StringRef> *out); | ||
|
||
template <typename T> | ||
struct ArrayPadding { | ||
|
||
using Args = std::tuple<ArrayRef<T>, int32_t, T>; | ||
|
||
bool operator()(ArrayRef<T> *arr, int32_t target_size, T default_value, ArrayRef<T> *out, bool *is_null) { | ||
if (target_size < 0) { | ||
out->size = 0; | ||
out->raw = nullptr; | ||
out->nullables = nullptr; | ||
} | ||
else if (arr->size >= target_size) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [cpplint] reported by reviewdog 🐶 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [cpplint] reported by reviewdog 🐶 |
||
// v1::AllocManagedArray(out, arr->size); | ||
out->size = arr->size; | ||
for (int i=0; i<arr->size; ++i) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [cpplint] reported by reviewdog 🐶 |
||
out->raw[i] = arr->raw[i]; | ||
out->nullables[i] = arr->nullables[i]; | ||
} | ||
} | ||
else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [cpplint] reported by reviewdog 🐶 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [cpplint] reported by reviewdog 🐶 |
||
// v1::AllocManagedArray(out, target_size); | ||
out->size = target_size; | ||
for (int i = 0; i < target_size; ++i) { | ||
if (i < arr->size) { | ||
out->nullables[i] = arr->nullables[i]; | ||
out->raw[i] = arr->raw[i]; | ||
} else { | ||
out->nullables[i] = false; | ||
out->raw[i] = default_value; | ||
// out->raw[i]->data_ = default_value.data_; | ||
// out->raw[i]->size_ = default_value.size_; | ||
} | ||
} | ||
} | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [cpplint] reported by reviewdog 🐶 |
||
}; | ||
|
||
} // namespace v1 | ||
|
||
/// \brief register native udf related methods into given UdfLibrary `lib` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[cpplint] reported by reviewdog 🐶
Redundant blank line at the start of a code block should be deleted. [whitespace/blank_line] [2]