You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/09/12 14:26:52 UTC

[GitHub] [spark] peter-toth commented on a diff in pull request #37851: [SPARK-40362][SQL] Fix BinaryComparison canonicalization

peter-toth commented on code in PR #37851:
URL: https://github.com/apache/spark/pull/37851#discussion_r968490045


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Canonicalize.scala:
##########
@@ -65,6 +78,15 @@ object Canonicalize {
       val newChildren = orderCommutative(l, { case Least(children) => children })
       Least(newChildren)
 
-    case _ => e.withNewChildren(e.children.map(reorderCommutativeOperators))
+    case bc: EqualTo => orderBinaryComparison(bc, EqualTo)
+    case bc: EqualNullSafe => orderBinaryComparison(bc, EqualNullSafe)
+
+    case bc: GreaterThan => orderBinaryComparison(bc, LessThan)
+    case bc: LessThan => orderBinaryComparison(bc, GreaterThan)
+
+    case bc: GreaterThanOrEqual => orderBinaryComparison(bc, LessThanOrEqual)
+    case bc: LessThanOrEqual => orderBinaryComparison(bc, GreaterThanOrEqual)
+
+    case _ => e.mapChildren(preCanonicalizeAndReorderOperators).preCanonicalized

Review Comment:
   We would say that we canonicalize and reorder the nodes children first and then canonicalize the node.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org