turboFei commented on a change in pull request #27150: [SPARK-30471][SQL] Fix 
issue when comparing String and IntegerType
URL: https://github.com/apache/spark/pull/27150#discussion_r366315154
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
 ##########
 @@ -136,11 +136,20 @@ object TypeCoercion {
     case (TimestampType, DateType) => Some(TimestampType)
     case (DateType, TimestampType) => Some(TimestampType)
 
-    // There is no proper decimal type we can pick,
-    // using double type is the best we can do.
-    // See SPARK-22469 for details.
-    case (n: DecimalType, s: StringType) => Some(DoubleType)
-    case (s: StringType, n: DecimalType) => Some(DoubleType)
+    case (l, r) if (l.isInstanceOf[StringType] && r.isInstanceOf[NumericType]) 
||
+      (l.isInstanceOf[NumericType] && r.isInstanceOf[StringType]) =>
+      if (conf.ansiEnabled) {
+        throw new ArithmeticException(
+          s"""
+            | Operator does not exist: $l compare $r
 
 Review comment:
   resolved

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to