zml1206 commented on code in PR #57815:
URL: https://github.com/apache/spark/pull/57815#discussion_r3763640382


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala:
##########
@@ -337,6 +337,23 @@ object WindowExpression {
     e.find(_.isInstanceOf[WindowExpression]).isDefined
   }
 
+  private[sql] def distinctAggregateChildren(function: AggregateFunction): 
Seq[Expression] = {
+    function.children.filterNot(_.foldable).map {
+      case sortOrder: SortOrder => sortOrder.child
+      case expression => expression
+    }.distinctBy(_.canonicalized)
+  }
+
+  private[sql] def isSupportedDistinctAggregate(

Review Comment:
   Agreed that this is a valid optimization opportunity. Since extending 
EliminateDistinct to Window requires deliberately separating the 
duplicate-agnostic functions from the order-sensitive First/Last cases, I’d 
prefer to address it in a separate JIRA rather than expand this PR further.



-- 
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]

Reply via email to