cloud-fan commented on a change in pull request #22038: [SPARK-25056][SQL] 
Unify the InConversion and BinaryComparison behavior
URL: https://github.com/apache/spark/pull/22038#discussion_r346297207
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
 ##########
 @@ -495,9 +495,12 @@ object TypeCoercion {
           i
         }
 
-      case i @ In(a, b) if b.exists(_.dataType != a.dataType) =>
-        findWiderCommonType(i.children.map(_.dataType)) match {
-          case Some(finalDataType) => i.withNewChildren(i.children.map(Cast(_, 
finalDataType)))
+      case i @ In(value, list) if list.exists(_.dataType != value.dataType) =>
+        findWiderCommonType(list.map(_.dataType)) match {
 
 Review comment:
   After taking a closer look, the existing logic for binary comparison seems 
to be:
   ```
   if (not decimal type) {
     apply findTightestCommonType
     apply findCommonTypeForBinaryComparison
   } else {
     if (both sides are decimal) {
       apply widerDecimalType 
     } if (one side is not decimal) {
       apply function integralAndDecimalLiteral
       apply function nondecimalAndDecimal
     }
   }
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to