helioshe4 commented on code in PR #54297:
URL: https://github.com/apache/spark/pull/54297#discussion_r2831104158
##########
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:
sounds good. I've implemented it similar to your original suggestion. We
have a boolean `ListAgg.hasDistinctOrderIncompatibility` that indicates whether
or not an illegal mismatch has occurred.
if it has, then we call the `listAgg.throwDistinctOrderError()`, which
chooses the correct error to throw depending on the type of mistmatch.
If it hasn't then we continue matching the next cases.
There's a bit of duplication on the `orderMistmatchCastSafety` call but it's
matching on different results.
--
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]