Skip to content

Conversation

@uros-db
Copy link
Contributor

@uros-db uros-db commented Apr 8, 2024

What changes were proposed in this pull request?

Enable collation support for hash aggregate.

Why are the changes needed?

Improve AGGREGATE performance for collated strings, arrays of strings, and structs with strings.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

E2e SQL tests in CollationSuite, existing TPCDS collation query test suite.

Was this patch authored or co-authored using generative AI tooling?

Yes.

@github-actions github-actions bot added the SQL label Apr 8, 2024
messageParameters = Map.empty)
case e: Attribute if !a.groupingExpressions.exists(_.semanticEquals(e)) =>
case e: Attribute if !a.groupingExpressions.exists(_.semanticEquals(e)) &&
!a.groupingExpressions.exists {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this change?

Copy link
Contributor Author

@uros-db uros-db Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without it, it hits the QueryCompilationErrors.columnNotInGroupByClauseError(e)
with error: Job aborted due to stage failure: Task 0 in stage 2.0 failed 1 times, most recent failure: Lost task 0.0 in stage 2.0 (TID 2) (192.168.15.30 executor driver): org.apache.spark.SparkException: [INTERNAL_ERROR] Couldn't find name#17 in [collationkey(name#17)#30,count(1)#19L] SQLSTATE: XX000

with query plan:

Aggregate [collationkey(name#17)], [any_value(name#17, false) AS name#24, count(1) AS count(1)#20L]
+- LogicalRDD [name#17], false

so name#17 is not found in groupingExpressions

@uros-db uros-db changed the title [DRAFT][SPARK-47692][SQL] Hash aggregate support for strings with collation [DRAFT][SPARK-47690][SQL] Hash aggregate support for strings with collation Apr 16, 2024
@uros-db uros-db changed the title [DRAFT][SPARK-47690][SQL] Hash aggregate support for strings with collation [DRAFT][SPARK-XXXXX][SQL] Hash aggregate support for strings with collation Apr 26, 2024
@uros-db uros-db changed the title [DRAFT][SPARK-XXXXX][SQL] Hash aggregate support for strings with collation [DRAFT][SPARK-47690][SQL] Hash aggregate support for strings with collation Apr 26, 2024
@uros-db uros-db changed the title [DRAFT][SPARK-47690][SQL] Hash aggregate support for strings with collation [DRAFT][SQL] Hash aggregate support for strings with collation May 31, 2024
@uros-db uros-db closed this May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants