-
Notifications
You must be signed in to change notification settings - Fork 28.8k
[SPARK-51820][FOLLOWUP][CONNECT] Replace literal in SortOrder
only under Sort
operator
#52189
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
[SPARK-51820][FOLLOWUP][CONNECT] Replace literal in SortOrder
only under Sort
operator
#52189
Conversation
6ced69c
to
7f033b1
Compare
7f033b1
to
f3530ab
Compare
SortOrder
only under Sort
operator
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.
LGTM!
@@ -1752,7 +1752,8 @@ class SparkConnectPlanner( | |||
transformUnresolvedExtractValue(exp.getUnresolvedExtractValue) | |||
case proto.Expression.ExprTypeCase.UPDATE_FIELDS => | |||
transformUpdateFields(exp.getUpdateFields) | |||
case proto.Expression.ExprTypeCase.SORT_ORDER => transformSortOrder(exp.getSortOrder) | |||
case proto.Expression.ExprTypeCase.SORT_ORDER => | |||
transformSortOrder(order = exp.getSortOrder, shouldReplaceOrdinals = false) |
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.
So using ordinals in ORDER BY
in window operator is not possible both in DF and in SQL?
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.
Yeah, ORDER BY 1
in window is just order by literal
@@ -962,6 +962,69 @@ class SparkConnectPlannerSuite extends SparkFunSuite with SparkConnectPlanTest { | |||
!aggregateExpression.containsPattern(TreePattern.UNRESOLVED_ORDINAL))) | |||
} | |||
|
|||
test("SPARK-51820 Literals in SortOrder should only be replaced under Sort node") { |
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.
I wonder why add a low-level proto test and not a high-level DF test?
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.
To force Spark Connect, otherwise it goes through Dataset.scala
API
thanks, merging to master! |
What changes were proposed in this pull request?
Replace literal in
SortOrder
only underSort
operatorWhy are the changes needed?
SPARK-51820 introduced a bug where literal under all
SortOrder
expressions were treated as ordinals, breaking Windows in Spark Connect. This PR fixes that.Does this PR introduce any user-facing change?
No
How was this patch tested?
Added a test case
Was this patch authored or co-authored using generative AI tooling?
No