-
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-43768: [C++] Fix the case when boolean_{any|all} meets constant input with length in Acero #43799
GH-43768: [C++] Fix the case when boolean_{any|all} meets constant input with length in Acero #43799
Changes from 3 commits
6120da4
74191a4
e700177
cab4b25
140e3be
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 |
---|---|---|
|
@@ -532,13 +532,13 @@ struct BooleanAnyImpl : public ScalarAggregator { | |
} | ||
if (batch[0].is_scalar()) { | ||
const Scalar& scalar = *batch[0].scalar; | ||
this->has_nulls = !scalar.is_valid; | ||
this->any = scalar.is_valid && checked_cast<const BooleanScalar&>(scalar).value; | ||
this->count += scalar.is_valid; | ||
this->has_nulls |= !scalar.is_valid; | ||
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. Is this correct? If the argument is a scalar, isn't it as if the whole batch was made from repeated values of that 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.
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 @mapleFU is right here. |
||
this->any |= scalar.is_valid && checked_cast<const BooleanScalar&>(scalar).value; | ||
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. Why 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. See #43799 (comment) |
||
this->count += scalar.is_valid * batch.length; | ||
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. This one I understand. |
||
return Status::OK(); | ||
} | ||
const ArraySpan& data = batch[0].array; | ||
this->has_nulls = data.GetNullCount() > 0; | ||
this->has_nulls |= data.GetNullCount() > 0; | ||
this->count += data.length - data.GetNullCount(); | ||
arrow::internal::OptionalBinaryBitBlockCounter counter( | ||
data.buffers[0].data, data.offset, data.buffers[1].data, data.offset, | ||
|
@@ -603,13 +603,13 @@ struct BooleanAllImpl : public ScalarAggregator { | |
} | ||
if (batch[0].is_scalar()) { | ||
const Scalar& scalar = *batch[0].scalar; | ||
this->has_nulls = !scalar.is_valid; | ||
this->count += scalar.is_valid; | ||
this->all = !scalar.is_valid || checked_cast<const BooleanScalar&>(scalar).value; | ||
this->has_nulls |= !scalar.is_valid; | ||
this->count += scalar.is_valid * batch.length; | ||
this->all &= !scalar.is_valid || checked_cast<const BooleanScalar&>(scalar).value; | ||
return Status::OK(); | ||
} | ||
const ArraySpan& data = batch[0].array; | ||
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. Why didn't change 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. done 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. And my question is why make it 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. The reason is in #43799 (comment) |
||
this->has_nulls = data.GetNullCount() > 0; | ||
this->has_nulls |= data.GetNullCount() > 0; | ||
this->count += data.length - data.GetNullCount(); | ||
arrow::internal::OptionalBinaryBitBlockCounter counter( | ||
data.buffers[1].data, data.offset, data.buffers[0].data, data.offset, | ||
|
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.
Is it possible to test more cases? Something like:
Also vary the
skip_nulls
and the boolean literal.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.
It's a bit hard to build test like this since the Literal column would only built by
Projection
here, but I've triedProject cannot make "different" literal in this scenerio
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.
@pitrou Would you mind take a quick look that whether the testing is ok?