harshmotw-db commented on code in PR #60634:
URL: https://github.com/apache/spark/pull/60634#discussion_r4648573942


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala:
##########
@@ -234,6 +234,11 @@ abstract class Optimizer(catalogManager: CatalogManager)
       ReplaceExceptWithFilter,
       ReplaceExceptWithAntiJoin,
       ReplaceDistinctWithAggregate),
+    // This batch must run after "Replace Operators", as that one turns 
Distinct and Deduplicate
+    // into Aggregate.
+    Batch("Insert Variant Canonicalization", FixedPoint(1),
+      InsertVariantCanonicalizationInAggregate,
+      InsertVariantCanonicalizationInRepartitionExpressions),

Review Comment:
   Oh this is tricky. Do you know of an alternative that would fix this? If the 
project is evaluated earlier, we also have a problem where if canonicalize 
fails on a row but if that row were inactive anyway, we would end up failing 
the query.
   
   I personally would be okay with the current approach because I would really 
doubt that the SQL spec guarantees an order of operations here. I'll leave it 
up to you
   



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