mikhailnik-db commented on code in PR #54297:
URL: https://github.com/apache/spark/pull/54297#discussion_r2827428918


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/resolver/AggregateExpressionResolver.scala:
##########
@@ -116,8 +118,7 @@ class AggregateExpressionResolver(
   private def validateResolvedAggregateExpression(aggregateExpression: 
AggregateExpression): Unit =
     aggregateExpression match {
       case agg @ AggregateExpression(listAgg: ListAgg, _, _, _, _)
-          if agg.isDistinct && listAgg.needSaveOrderValue =>
-        throwFunctionAndOrderExpressionMismatchError(listAgg)
+          if agg.isDistinct => listAgg.validateDistinctOrderCompatibility()

Review Comment:
   Here it'll work now, but I believe it's not good in the long run. It'll be 
too easy for someone later to add some validation that should run for all 
`AggregateExpression`, and it will be very natural to add it in the end without 
reading all of them (you can see how many there are in `CheckAnalysis`). And 
all their tests will pass, because they won't use such a specific function as 
`listagg` for testing.
   
   Codebase like Spark has a lot of contributors, and we should make the code 
as error-proof as possible for future generations.



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