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 is 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: [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]