You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/12/07 05:23:16 UTC
[GitHub] [spark] c21 opened a new pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
c21 opened a new pull request #34826:
URL: https://github.com/apache/spark/pull/34826
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'core/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
We can support `SortAggregateExec` code-gen without grouping keys. When there's no grouping key, sort aggregate should share same execution logic with hash aggregate.
At a high level, this PR does
* `spark.sql.codegen.aggregate.sortAggregate.enabled`: a new config (user-facing) is introduced to allow users to disable sort aggregate in case anything going wrong, and it's enabled by default.
* `spark.sql.aggregate.forceApplySortAggregate`: an internal config (non-user-facing) is introduced to allow developers test sort aggregate, to improve unit test coverage of it. We already had a similar config for shuffled hash join.
* `AggregateCodegenSupport.scala`: The base class to have implementation of code-gen without grouping keys and other code-gen related boilerplate code. The subclass is required to implement `doProduceWithKeys()` and `doConsumeWithKeys()` to handle aggregate with grouping keys. The implementation in this class is copied literarily from `HashAggregateExec`.
* `HashAggregateExec.scala`: only keeps its original `doProduceWithKeys()` and `doConsumeWithKeys()`.
* `SortAggregateExec.scala`: extends `AggregateCodegenSupport.scala` to support code-gen without grouping keys.
The implementation of `SortAggregateExec` code-gen with grouping keys will be added in follow-up PR.
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
To enable code-gen for sort aggregate, so we can have better query performance when sort aggregate is used.
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
The config of `spark.sql.codegen.aggregate.sortAggregate.enabled` to enable/disable sort aggregate code-gen.
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
Added unit test in `WholeStageCodegenSuite.scala`.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989642124
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146024/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] c21 commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
c21 commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996973090
Thank you @cloud-fan for review!
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996586337
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50801/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-987671466
**[Test build #145976 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145976/testReport)** for PR 34826 at commit [`6d59a40`](https://github.com/apache/spark/commit/6d59a4061e7b4a3a317c5c19e5a86c193921c518).
* This patch **fails Spark unit tests**.
* This patch merges cleanly.
* This patch adds no public classes.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] c21 commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
c21 commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-987583053
@cloud-fan could you help take a look when you have time? Thanks.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] c21 commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
c21 commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996388455
Rebased to latest master.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996722750
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146327/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996557184
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50801/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] c21 commented on a change in pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
c21 commented on a change in pull request #34826:
URL: https://github.com/apache/spark/pull/34826#discussion_r763639377
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/SortAggregateExec.scala
##########
@@ -36,11 +40,12 @@ case class SortAggregateExec(
initialInputBufferOffset: Int,
resultExpressions: Seq[NamedExpression],
child: SparkPlan)
- extends BaseAggregateExec
+ extends AggregateCodegenSupport
with AliasAwareOutputOrdering {
override lazy val metrics = Map(
- "numOutputRows" -> SQLMetrics.createMetric(sparkContext, "number of output rows"))
+ "numOutputRows" -> SQLMetrics.createMetric(sparkContext, "number of output rows"),
+ "aggTime" -> SQLMetrics.createTimingMetric(sparkContext, "time in aggregation build"))
Review comment:
We need to collect `aggTime` metrics here as well, because (1).hash aggregate's `doProduceWithoutKeys()` already generates code for it, and (2).it's good to have anyway.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989487584
**[Test build #146024 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146024/testReport)** for PR 34826 at commit [`132ce3c`](https://github.com/apache/spark/commit/132ce3c8491bc60e029822ce80c6fec43bc56c31).
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996680003
thanks, merging to master!
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-987656360
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50451/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989511687
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50499/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996430756
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50783/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996430730
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50783/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-987589559
**[Test build #145976 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145976/testReport)** for PR 34826 at commit [`6d59a40`](https://github.com/apache/spark/commit/6d59a4061e7b4a3a317c5c19e5a86c193921c518).
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-987618753
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50451/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-987700307
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145976/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996504369
**[Test build #146311 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146311/testReport)** for PR 34826 at commit [`f6512ef`](https://github.com/apache/spark/commit/f6512ef777d81caa92084d065c5c2b398dd6bc8d).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996389266
**[Test build #146311 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146311/testReport)** for PR 34826 at commit [`f6512ef`](https://github.com/apache/spark/commit/f6512ef777d81caa92084d065c5c2b398dd6bc8d).
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-987656360
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50451/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989634556
**[Test build #146024 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146024/testReport)** for PR 34826 at commit [`132ce3c`](https://github.com/apache/spark/commit/132ce3c8491bc60e029822ce80c6fec43bc56c31).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989568748
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146022/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989568307
**[Test build #146022 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146022/testReport)** for PR 34826 at commit [`3734130`](https://github.com/apache/spark/commit/3734130d8235a24c4c73c5f4d4bcc8bd6cf8fe6d).
* This patch **fails Spark unit tests**.
* This patch merges cleanly.
* This patch adds no public classes.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] c21 commented on a change in pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
c21 commented on a change in pull request #34826:
URL: https://github.com/apache/spark/pull/34826#discussion_r771185135
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/WholeStageCodegenExec.scala
##########
@@ -47,7 +47,8 @@ trait CodegenSupport extends SparkPlan {
/** Prefix used in the current operator's variable names. */
private def variablePrefix: String = this match {
- case _: HashAggregateExec => "agg"
+ case _: HashAggregateExec => "hagg"
+ case _: SortAggregateExec => "sagg"
Review comment:
@cloud-fan - updated.
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/WholeStageCodegenExec.scala
##########
@@ -47,7 +47,8 @@ trait CodegenSupport extends SparkPlan {
/** Prefix used in the current operator's variable names. */
private def variablePrefix: String = this match {
- case _: HashAggregateExec => "agg"
+ case _: HashAggregateExec => "hagg"
Review comment:
@cloud-fan - updated.
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/AggUtils.scala
##########
@@ -529,4 +533,13 @@ object AggUtils {
case None => partialAggregate
}
}
+
+ /**
+ * Returns whether a sort aggregate should be force applied.
+ * The config key is hard-coded because it's testing only and should not be exposed.
+ */
+ private def forceApplySortAggregate(conf: SQLConf): Boolean = {
+ Utils.isTesting &&
+ conf.getConfString("spark.sql.aggregate.forceApplySortAggregate", "false") == "true"
Review comment:
@cloud-fan - updated.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996530145
**[Test build #146327 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146327/testReport)** for PR 34826 at commit [`b1fc0a9`](https://github.com/apache/spark/commit/b1fc0a978012a6ef86bea7b98240ac4da0266ea1).
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34826:
URL: https://github.com/apache/spark/pull/34826#discussion_r771118522
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/WholeStageCodegenExec.scala
##########
@@ -47,7 +47,8 @@ trait CodegenSupport extends SparkPlan {
/** Prefix used in the current operator's variable names. */
private def variablePrefix: String = this match {
- case _: HashAggregateExec => "agg"
+ case _: HashAggregateExec => "hagg"
Review comment:
I think `hashAgg` is better as it's clear and not very long.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989505681
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50499/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-987700307
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/145976/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989511687
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50499/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989538428
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50500/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989527920
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50500/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989568748
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146022/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989487584
**[Test build #146024 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146024/testReport)** for PR 34826 at commit [`132ce3c`](https://github.com/apache/spark/commit/132ce3c8491bc60e029822ce80c6fec43bc56c31).
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989462951
**[Test build #146022 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146022/testReport)** for PR 34826 at commit [`3734130`](https://github.com/apache/spark/commit/3734130d8235a24c4c73c5f4d4bcc8bd6cf8fe6d).
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989538428
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50500/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996430756
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50783/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996505980
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146311/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996716129
**[Test build #146327 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146327/testReport)** for PR 34826 at commit [`b1fc0a9`](https://github.com/apache/spark/commit/b1fc0a978012a6ef86bea7b98240ac4da0266ea1).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] c21 commented on a change in pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
c21 commented on a change in pull request #34826:
URL: https://github.com/apache/spark/pull/34826#discussion_r763637325
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/AggregateCodegenSupport.scala
##########
@@ -0,0 +1,336 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.aggregate
+
+import org.apache.spark.rdd.RDD
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Attribute, Expression, ExpressionEquals}
+import org.apache.spark.sql.catalyst.expressions.BindReferences.bindReferences
+import org.apache.spark.sql.catalyst.expressions.aggregate._
+import org.apache.spark.sql.catalyst.expressions.codegen._
+import org.apache.spark.sql.catalyst.expressions.codegen.Block._
+import org.apache.spark.sql.catalyst.util.DateTimeConstants.NANOS_PER_MILLIS
+import org.apache.spark.sql.execution.{BlockingOperatorWithCodegen, CodegenSupport, GeneratePredicateHelper}
+import org.apache.spark.util.Utils
+
+/**
+ * An interface for those aggregate physical operators that support codegen.
+ */
+trait AggregateCodegenSupport
Review comment:
All variables and methods in this class is copied literarily from `HashAggregateExec.scala` with same names.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34826:
URL: https://github.com/apache/spark/pull/34826#discussion_r771118593
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/WholeStageCodegenExec.scala
##########
@@ -47,7 +47,8 @@ trait CodegenSupport extends SparkPlan {
/** Prefix used in the current operator's variable names. */
private def variablePrefix: String = this match {
- case _: HashAggregateExec => "agg"
+ case _: HashAggregateExec => "hagg"
+ case _: SortAggregateExec => "sagg"
Review comment:
ditto, `sortAgg`
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan closed pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #34826:
URL: https://github.com/apache/spark/pull/34826
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996408427
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50783/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996608853
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50801/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-987645360
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50451/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-987589559
**[Test build #145976 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/145976/testReport)** for PR 34826 at commit [`6d59a40`](https://github.com/apache/spark/commit/6d59a4061e7b4a3a317c5c19e5a86c193921c518).
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989485584
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50499/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] c21 commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
c21 commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989566637
cc @cloud-fan - just FYI this PR is ready for review, thanks.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989507940
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50500/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] c21 commented on a change in pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
c21 commented on a change in pull request #34826:
URL: https://github.com/apache/spark/pull/34826#discussion_r765398742
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/AggregateCodegenSupport.scala
##########
@@ -0,0 +1,340 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql.execution.aggregate
+
+import org.apache.spark.rdd.RDD
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeSet, Expression, ExpressionEquals, UnsafeRow}
+import org.apache.spark.sql.catalyst.expressions.BindReferences.bindReferences
+import org.apache.spark.sql.catalyst.expressions.aggregate._
+import org.apache.spark.sql.catalyst.expressions.codegen._
+import org.apache.spark.sql.catalyst.expressions.codegen.Block._
+import org.apache.spark.sql.catalyst.util.DateTimeConstants.NANOS_PER_MILLIS
+import org.apache.spark.sql.execution.{BlockingOperatorWithCodegen, CodegenSupport, GeneratePredicateHelper}
+import org.apache.spark.util.Utils
+
+/**
+ * An interface for those aggregate physical operators that support codegen.
+ */
+trait AggregateCodegenSupport
+ extends BaseAggregateExec
+ with BlockingOperatorWithCodegen
+ with GeneratePredicateHelper {
+
+ /**
+ * All the modes of aggregate expressions.
+ */
+ protected val modes: Seq[AggregateMode] = aggregateExpressions.map(_.mode).distinct
+
+ /**
+ * The variables are used as aggregation buffers and each aggregate function has one or more
+ * ExprCode to initialize its buffer slots. Only used for aggregation without keys.
+ */
+ private var bufVars: Seq[Seq[ExprCode]] = _
+
+ /**
+ * The generated code for `doProduce` call when aggregate has grouping keys.
+ */
+ protected def doProduceWithKeys(ctx: CodegenContext): String
+
+ /**
+ * The generated code for `doConsume` call when aggregate has grouping keys.
+ */
+ protected def doConsumeWithKeys(ctx: CodegenContext, input: Seq[ExprCode]): String
+
+ protected override def doProduce(ctx: CodegenContext): String = {
+ if (groupingExpressions.isEmpty) {
+ doProduceWithoutKeys(ctx)
+ } else {
+ doProduceWithKeys(ctx)
+ }
+ }
+
+ override def doConsume(ctx: CodegenContext, input: Seq[ExprCode], row: ExprCode): String = {
+ if (groupingExpressions.isEmpty) {
+ doConsumeWithoutKeys(ctx, input)
+ } else {
+ doConsumeWithKeys(ctx, input)
+ }
+ }
+
+ override def supportCodegen: Boolean = {
+ val isMutableAggBuffer = aggregateBufferAttributes.forall(a => UnsafeRow.isMutable(a.dataType))
Review comment:
Add check for aggregate buffer mutable or not. This is already implicitly checked for hash aggregate during planning: `HashAggregateExec.supportsAggregate()`. Make it explicit as requirement for code-gen as well here.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989462951
**[Test build #146022 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146022/testReport)** for PR 34826 at commit [`3734130`](https://github.com/apache/spark/commit/3734130d8235a24c4c73c5f4d4bcc8bd6cf8fe6d).
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-989642124
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146024/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] c21 commented on a change in pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
c21 commented on a change in pull request #34826:
URL: https://github.com/apache/spark/pull/34826#discussion_r771151953
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/AggUtils.scala
##########
@@ -529,4 +533,13 @@ object AggUtils {
case None => partialAggregate
}
}
+
+ /**
+ * Returns whether a sort aggregate should be force applied.
+ * The config key is hard-coded because it's testing only and should not be exposed.
+ */
+ private def forceApplySortAggregate(conf: SQLConf): Boolean = {
+ Utils.isTesting &&
+ conf.getConfString("spark.sql.aggregate.forceApplySortAggregate", "false") == "true"
Review comment:
@cloud-fan - I was actually following same naming as [`spark.sql.join.forceApplyShuffledHashJoin`](https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/joins.scala#L446), but I agree `.test.` is better. Will update.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996608853
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50801/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996389266
**[Test build #146311 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146311/testReport)** for PR 34826 at commit [`f6512ef`](https://github.com/apache/spark/commit/f6512ef777d81caa92084d065c5c2b398dd6bc8d).
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996505980
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146311/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996722750
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146327/
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] c21 commented on a change in pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
c21 commented on a change in pull request #34826:
URL: https://github.com/apache/spark/pull/34826#discussion_r771121560
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/WholeStageCodegenExec.scala
##########
@@ -47,7 +47,8 @@ trait CodegenSupport extends SparkPlan {
/** Prefix used in the current operator's variable names. */
private def variablePrefix: String = this match {
- case _: HashAggregateExec => "agg"
+ case _: HashAggregateExec => "hagg"
Review comment:
@cloud-fan - sure, will update.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #34826:
URL: https://github.com/apache/spark/pull/34826#discussion_r771126434
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/AggUtils.scala
##########
@@ -529,4 +533,13 @@ object AggUtils {
case None => partialAggregate
}
}
+
+ /**
+ * Returns whether a sort aggregate should be force applied.
+ * The config key is hard-coded because it's testing only and should not be exposed.
+ */
+ private def forceApplySortAggregate(conf: SQLConf): Boolean = {
+ Utils.isTesting &&
+ conf.getConfString("spark.sql.aggregate.forceApplySortAggregate", "false") == "true"
Review comment:
I'd use `spark.sql.test.forceApplySortAggregate` to make the intention clear
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #34826: [SPARK-37564][SQL] Add code-gen for sort aggregate without grouping keys
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34826:
URL: https://github.com/apache/spark/pull/34826#issuecomment-996530145
**[Test build #146327 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146327/testReport)** for PR 34826 at commit [`b1fc0a9`](https://github.com/apache/spark/commit/b1fc0a978012a6ef86bea7b98240ac4da0266ea1).
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org