-
Notifications
You must be signed in to change notification settings - Fork 28.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DRAFT][SQL] Hash aggregate support for strings with collation #45929
Conversation
@@ -168,7 +168,13 @@ object ExprUtils extends QueryErrorsBase { | |||
a.failAnalysis( | |||
errorClass = "MISSING_GROUP_BY", | |||
messageParameters = Map.empty) | |||
case e: Attribute if !a.groupingExpressions.exists(_.semanticEquals(e)) => | |||
case e: Attribute if !a.groupingExpressions.exists(_.semanticEquals(e)) && | |||
!a.groupingExpressions.exists { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.