Masykus commented on code in PR #47246:
URL: https://github.com/apache/spark/pull/47246#discussion_r1667894249


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala:
##########
@@ -998,10 +998,27 @@ abstract class BinaryComparison extends BinaryOperator 
with Predicate {
     }
   }
 
-  protected lazy val ordering: Ordering[Any] = 
TypeUtils.getInterpretedOrdering(left.dataType)
+  protected lazy val ordering: Ordering[Any] = new Ordering[Any] {
+    override def compare(x: Any, y: Any): Int = {
+      (x, y) match {
+        // Handle comparison when the left side is a String and the right side 
is an Integer
+        case (xs: String, yi: Int) => xs.toIntOption match {

Review Comment:
   by this logic "000001" will be converted to 1, so "000001" == 1 = true. I am 
not sure this is expected behavior. 
   I guess always converting int to string will be more predictable



-- 
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-unsubscr...@spark.apache.org

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


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

Reply via email to