-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
GH-34315: [C++] Correct is_null kernel for Union and RunEndEncoded logical nulls #35036
base: main
Are you sure you want to change the base?
Changes from 1 commit
0ded622
6fa5eeb
d661a16
197005a
45a1cdb
f93ecae
621f024
0cb0d8b
07a9c58
0535a01
9a6e4b1
e836da6
3e086be
9ee9820
bd34e35
3f174b0
c89f43d
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 | ||||
---|---|---|---|---|---|---|
|
@@ -236,6 +236,19 @@ void SetOffsetsForScalar(ArraySpan* span, offset_type* buffer, int64_t value_siz | |||||
span->buffers[buffer_index].size = 2 * sizeof(offset_type); | ||||||
} | ||||||
|
||||||
template <typename ArrowType> | ||||||
void SetRunForScalar(ArraySpan* span, std::shared_ptr<DataType> type, | ||||||
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.
|
||||||
uint64_t* scratch_space) { | ||||||
// Create a lenght-1 array with the value 1 for a REE scalar | ||||||
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. length typo 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. I think the comment can be removed after the other changes that clarify the code are made. |
||||||
using run_type = typename ArrowType::c_type; | ||||||
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.
|
||||||
auto buffer = reinterpret_cast<run_type*>(scratch_space); | ||||||
buffer[0] = static_cast<run_type>(1); | ||||||
auto data_buffer = | ||||||
std::make_shared<Buffer>(reinterpret_cast<uint8_t*>(buffer), sizeof(run_type)); | ||||||
auto data = ArrayData::Make(type, 1, {nullptr, data_buffer}, 0); | ||||||
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.
|
||||||
span->child_data[0].SetMembers(*data); | ||||||
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. I think it's better if the caller passes 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. You could derive the |
||||||
} | ||||||
|
||||||
int GetNumBuffers(const DataType& type) { | ||||||
switch (type.id()) { | ||||||
case Type::NA: | ||||||
|
@@ -430,8 +443,17 @@ void ArraySpan::FillFromScalar(const Scalar& value) { | |||||
const auto& scalar = checked_cast<const RunEndEncodedScalar&>(value); | ||||||
this->child_data.resize(2); | ||||||
auto& run_end_type = scalar.run_end_type(); | ||||||
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. Nit: style
Suggested change
|
||||||
auto run_end = MakeScalar(run_end_type, 1).ValueOrDie(); | ||||||
this->child_data[0].FillFromScalar(*run_end); | ||||||
switch (run_end_type->id()) { | ||||||
case Type::INT16: | ||||||
SetRunForScalar<Int16Type>(this, run_end_type, this->scratch_space); | ||||||
break; | ||||||
case Type::INT32: | ||||||
SetRunForScalar<Int32Type>(this, run_end_type, this->scratch_space); | ||||||
break; | ||||||
default: | ||||||
DCHECK_EQ(run_end_type->id(), Type::INT64); | ||||||
SetRunForScalar<Int64Type>(this, run_end_type, this->scratch_space); | ||||||
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. You're getting that stack trace you posted above from this new implementation? I think this will be less risky if you use the 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.
No, that was with the previous implementation. This last commit was to fix that 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. But thanks for the comments! Will clean-up |
||||||
} | ||||||
this->child_data[1].FillFromScalar(*scalar.value); | ||||||
} else if (type_id == Type::EXTENSION) { | ||||||
// Pass through storage | ||||||
|
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.
nitpick: To be consistent with REE code elsewhere:
RunEndType
.