Skip to content
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

Fix canonicalization regression with Spark 3.2 #3403

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@ case class GpuAggregateExpression(origAggregateFunction: GpuAggregateFunction,
// We compute the same thing regardless of our final result.
override lazy val canonicalized: Expression = {
val normalizedAggFunc = mode match {
// For PartialMerge or Final mode, the input to the `aggregateFunction` is aggregate buffers,
// and the actual children of `aggregateFunction` is not used, here we normalize the expr id.
case PartialMerge | Final => aggregateFunction.transform {
// For Partial, PartialMerge, or Final mode, the input to the `aggregateFunction` is
// aggregate buffers, and the actual children of `aggregateFunction` is not used,
// here we normalize the expr id.
case Partial | PartialMerge | Final => aggregateFunction.transform {
case a: AttributeReference => a.withExprId(ExprId(0))
}
case Partial | Complete => aggregateFunction
case Complete => aggregateFunction
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if we normalize all? (i.e. no match).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did wonder about that as well but I really don't know. Prior to this PR, our code matches Spark, so there seems to be a reason not to apply this in all cases.

}

GpuAggregateExpression(
Expand Down