You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mapleFU (via GitHub)" <gi...@apache.org> on 2024/08/23 03:51:27 UTC
[PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
mapleFU opened a new pull request, #43799:
URL: https://github.com/apache/arrow/pull/43799
<!--
Thanks for opening a pull request!
If this is your first pull request you can find detailed information on how
to contribute here:
* [New Contributor's Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
* [Contributing Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
Then could you also rename the pull request title in the following format?
GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
or
MINOR: [${COMPONENT}] ${SUMMARY}
In the case of PARQUET issues on JIRA the title also supports:
PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
-->
### Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
See https://github.com/apache/arrow/issues/43768
### What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
Fix the case when boolean_{any|all} meets constant input with length in Acero
### Are these changes tested?
Yes
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
### Are there any user-facing changes?
no
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please uncomment the line below and explain which changes are breaking.
-->
<!-- **This PR includes breaking changes to public APIs.** -->
<!--
Please uncomment the line below (and provide explanation) if the changes fix either (a) a security vulnerability, (b) a bug that caused incorrect or invalid data to be produced, or (c) a bug that causes a crash (even when the API contract is upheld). We use this to highlight fixes to issues that may affect users without their knowledge. For this reason, fixing bugs that cause errors don't count, since those are usually obvious.
-->
<!-- **This PR contains a "Critical Fix".** -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on PR #43799:
URL: https://github.com/apache/arrow/pull/43799#issuecomment-2310607177
> https://github.com/apache/arrow/blob/e61c105c73dfabb51d5afc972ff21cc5326b3d93/cpp/src/arrow/acero/scalar_aggregate_node.cc#L222
>
> @felipecrv The problem is here, the `ScalarAggregateExecutor` would do this well, but acero would continue using `consume` rather than handle each batch separately
Isn't that a problem in itself?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #43799:
URL: https://github.com/apache/arrow/pull/43799#discussion_r1736669728
##########
cpp/src/arrow/acero/aggregate_node_test.cc:
##########
@@ -210,5 +210,36 @@ TEST(GroupByNode, NoSkipNulls) {
AssertExecBatchesEqualIgnoringOrder(out_schema, {expected_batch}, out_batches.batches);
}
+TEST(ScalarAggregateNode, AnyAll) {
+ // GH-43768: boolean_any and boolean_all with constant input should work well
+ // when min_count != 0.
+ std::shared_ptr<Schema> in_schema = schema({field("not_used", int32())});
+ std::shared_ptr<Schema> out_schema = schema({field("agg_out", boolean())});
+ std::vector<ExecBatch> batches{
+ ExecBatchFromJSON({int32()}, "[[42], [42], [42], [42]]")};
Review Comment:
Is it possible to test more cases? Something like:
```c++
struct AnyAllCase {
std::string batches_json;
std::string expected_json;
};
std::vector<AnyAllCase> cases {
{"[[42], []]", "[[false]]"},
{"[[42, 42], []]", "[[true]]"},
{"[[42], [42]]", "[[true]]"},
{"[[42], [42, 42]]", "[[true]]"},
{"[[42], []]", "[[false]]"},
{"[[42, 42], []]", "[[true]]"},
{"[[42], [42]]", "[[true]]"},
{"[[42], [42, 42]]", "[[true]]"},
};
```
Also vary the `skip_nulls` and the boolean literal.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "zanmato1984 (via GitHub)" <gi...@apache.org>.
zanmato1984 commented on code in PR #43799:
URL: https://github.com/apache/arrow/pull/43799#discussion_r1728379343
##########
cpp/src/arrow/compute/kernels/aggregate_basic.cc:
##########
@@ -603,9 +603,9 @@ 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;
Review Comment:
Why didn't change `has_null =` to `has_null |=` as what you did for `any`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #43799:
URL: https://github.com/apache/arrow/pull/43799#issuecomment-2308439586
https://github.com/apache/arrow/blob/e61c105c73dfabb51d5afc972ff21cc5326b3d93/cpp/src/arrow/acero/scalar_aggregate_node.cc#L222
@felipecrv The problem is here, the `ScalarAggregateExecutor` would do this well, but acero would continue using `consume` rather than handle each batch separately
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #43799:
URL: https://github.com/apache/arrow/pull/43799#discussion_r1730027992
##########
cpp/src/arrow/compute/kernels/aggregate_basic.cc:
##########
@@ -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;
+ this->any |= scalar.is_valid && checked_cast<const BooleanScalar&>(scalar).value;
Review Comment:
See https://github.com/apache/arrow/pull/43799#issuecomment-2308439586
##########
cpp/src/arrow/compute/kernels/aggregate_basic.cc:
##########
@@ -603,9 +603,9 @@ 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;
Review Comment:
The reason is in https://github.com/apache/arrow/pull/43799#issuecomment-2308439586
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on PR #43799:
URL: https://github.com/apache/arrow/pull/43799#issuecomment-2313919387
Makes sense @mapleFU. I'm learning. :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #43799:
URL: https://github.com/apache/arrow/pull/43799#discussion_r1729952798
##########
cpp/src/arrow/compute/kernels/aggregate_basic.cc:
##########
@@ -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;
+ this->any |= scalar.is_valid && checked_cast<const BooleanScalar&>(scalar).value;
Review Comment:
Why the `|`? Isn't that necessary only in `MergeFrom`?
##########
cpp/src/arrow/compute/kernels/aggregate_basic.cc:
##########
@@ -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;
+ this->any |= scalar.is_valid && checked_cast<const BooleanScalar&>(scalar).value;
+ this->count += scalar.is_valid * batch.length;
Review Comment:
This one I understand.
##########
cpp/src/arrow/compute/kernels/aggregate_basic.cc:
##########
@@ -603,9 +603,9 @@ 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;
Review Comment:
And my question is why make it `|=` instead of simply `=`?
##########
cpp/src/arrow/compute/kernels/aggregate_basic.cc:
##########
@@ -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;
Review Comment:
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?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #43799:
URL: https://github.com/apache/arrow/pull/43799#discussion_r1736799342
##########
cpp/src/arrow/acero/aggregate_node_test.cc:
##########
@@ -210,5 +210,36 @@ TEST(GroupByNode, NoSkipNulls) {
AssertExecBatchesEqualIgnoringOrder(out_schema, {expected_batch}, out_batches.batches);
}
+TEST(ScalarAggregateNode, AnyAll) {
+ // GH-43768: boolean_any and boolean_all with constant input should work well
+ // when min_count != 0.
+ std::shared_ptr<Schema> in_schema = schema({field("not_used", int32())});
+ std::shared_ptr<Schema> out_schema = schema({field("agg_out", boolean())});
+ std::vector<ExecBatch> batches{
+ ExecBatchFromJSON({int32()}, "[[42], [42], [42], [42]]")};
Review Comment:
It's a bit hard to build test like this since the Literal column would only built by `Projection` here, but I've tried
Project cannot make "different" literal in this scenerio
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #43799:
URL: https://github.com/apache/arrow/pull/43799#discussion_r1728392277
##########
cpp/src/arrow/compute/kernels/aggregate_basic.cc:
##########
@@ -603,9 +603,9 @@ 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;
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #43799:
URL: https://github.com/apache/arrow/pull/43799#discussion_r1741045971
##########
cpp/src/arrow/acero/aggregate_node_test.cc:
##########
@@ -210,5 +210,36 @@ TEST(GroupByNode, NoSkipNulls) {
AssertExecBatchesEqualIgnoringOrder(out_schema, {expected_batch}, out_batches.batches);
}
+TEST(ScalarAggregateNode, AnyAll) {
+ // GH-43768: boolean_any and boolean_all with constant input should work well
+ // when min_count != 0.
+ std::shared_ptr<Schema> in_schema = schema({field("not_used", int32())});
+ std::shared_ptr<Schema> out_schema = schema({field("agg_out", boolean())});
+ std::vector<ExecBatch> batches{
+ ExecBatchFromJSON({int32()}, "[[42], [42], [42], [42]]")};
Review Comment:
@pitrou Would you mind take a quick look that whether the testing is ok?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: [C++] Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "conbench-apache-arrow[bot] (via GitHub)" <gi...@apache.org>.
conbench-apache-arrow[bot] commented on PR #43799:
URL: https://github.com/apache/arrow/pull/43799#issuecomment-2325451358
After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 9cafbb26681a1488c16edaec231ba55c21543e3a.
There were no benchmark performance regressions. 🎉
The [full Conbench report](https://github.com/apache/arrow/runs/29586687904) has more details. It also includes information about 7 possible false positives for unstable benchmarks that are known to sometimes produce them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #43799:
URL: https://github.com/apache/arrow/pull/43799#discussion_r1730027887
##########
cpp/src/arrow/compute/kernels/aggregate_basic.cc:
##########
@@ -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;
Review Comment:
1. If previous is `has_null`, it always has_null ( that's why using `|=` )
2. `!scalar.is_valid` means has-null, so it would set by this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #43799:
URL: https://github.com/apache/arrow/pull/43799#issuecomment-2306128871
:warning: GitHub issue #43768 **has been automatically assigned in GitHub** to PR creator.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #43799:
URL: https://github.com/apache/arrow/pull/43799#issuecomment-2306128877
@zanmato1984 @pitrou would you mind take a look?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on code in PR #43799:
URL: https://github.com/apache/arrow/pull/43799#discussion_r1736799342
##########
cpp/src/arrow/acero/aggregate_node_test.cc:
##########
@@ -210,5 +210,36 @@ TEST(GroupByNode, NoSkipNulls) {
AssertExecBatchesEqualIgnoringOrder(out_schema, {expected_batch}, out_batches.batches);
}
+TEST(ScalarAggregateNode, AnyAll) {
+ // GH-43768: boolean_any and boolean_all with constant input should work well
+ // when min_count != 0.
+ std::shared_ptr<Schema> in_schema = schema({field("not_used", int32())});
+ std::shared_ptr<Schema> out_schema = schema({field("agg_out", boolean())});
+ std::vector<ExecBatch> batches{
+ ExecBatchFromJSON({int32()}, "[[42], [42], [42], [42]]")};
Review Comment:
It's a bit hard to build test like this since the Literal column would only built by `Projection` here, but I've tried
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #43799:
URL: https://github.com/apache/arrow/pull/43799#issuecomment-2310620194
> Isn't that a problem in itself?
IMO we don't declare that `SCALAR_AGGREGATE` is for "each call consume once, and merge into a final state". So we'd better not expect that?
I would also glad to put the acero with other method but I think modify `Boolean{Any|All}` would be ok and no more cost?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: [C++] Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU merged PR #43799:
URL: https://github.com/apache/arrow/pull/43799
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "zanmato1984 (via GitHub)" <gi...@apache.org>.
zanmato1984 commented on code in PR #43799:
URL: https://github.com/apache/arrow/pull/43799#discussion_r1728371405
##########
cpp/src/arrow/acero/aggregate_node_test.cc:
##########
@@ -210,5 +210,36 @@ TEST(GroupByNode, NoSkipNulls) {
AssertExecBatchesEqualIgnoringOrder(out_schema, {expected_batch}, out_batches.batches);
}
+TEST(GroupByNode, AnyAndOr) {
Review Comment:
```suggestion
TEST(ScalarAggregateNode, AnyAll) {
```
##########
cpp/src/arrow/acero/aggregate_node_test.cc:
##########
@@ -210,5 +210,36 @@ TEST(GroupByNode, NoSkipNulls) {
AssertExecBatchesEqualIgnoringOrder(out_schema, {expected_batch}, out_batches.batches);
}
+TEST(GroupByNode, AnyAndOr) {
Review Comment:
This is for `ScalarAggregateNode` rather than `GroupByNode`. And it's for `any` and `all`, not `or`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "mapleFU (via GitHub)" <gi...@apache.org>.
mapleFU commented on PR #43799:
URL: https://github.com/apache/arrow/pull/43799#issuecomment-2318256727
@pitrou @bkietz would you mind take a look?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-43768: Fix the case when boolean_{any|all} meets constant input with length in Acero [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #43799:
URL: https://github.com/apache/arrow/pull/43799#discussion_r1736627156
##########
cpp/src/arrow/compute/kernels/aggregate_basic.cc:
##########
@@ -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;
Review Comment:
I think @mapleFU is right here. `this->has_nulls` is meant to represent whether any null was encountered, so it should never change from `true` to `false`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org