cloud-fan commented on code in PR #37519:
URL: https://github.com/apache/spark/pull/37519#discussion_r947697059
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala:
##########
@@ -1528,8 +1528,8 @@ object EliminateSorts extends Rule[LogicalPlan] {
applyLocally.lift(child).getOrElse(child)
case s @ Sort(_, global, child) => s.copy(child =
recursiveRemoveSort(child, global))
case j @ Join(originLeft, originRight, _, cond, _) if
cond.forall(_.deterministic) =>
- j.copy(left = recursiveRemoveSort(originLeft, true),
- right = recursiveRemoveSort(originRight, true))
+ j.copy(left = recursiveRemoveSort(originLeft, true,
canEliminateThroughLocalLimit = true),
+ right = recursiveRemoveSort(originRight, true,
canEliminateThroughLocalLimit = true))
case g @ Aggregate(_, aggs, originChild) if isOrderIrrelevantAggs(aggs) =>
g.copy(child = recursiveRemoveSort(originChild, true))
Review Comment:
I think aggregate can eliminate sort through local limit as well. The point
is, local limit does not guarantee any semantic (the result depends on the data
partitioning) and end-users won't have any expectations for it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]