HyukjinKwon commented on a change in pull request #28572:
URL: https://github.com/apache/spark/pull/28572#discussion_r427125934



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -3071,15 +3071,28 @@ class Analyzer(
       case p => p transformExpressions {
         case u @ UpCast(child, _, _) if !child.resolved => u
 
-        case UpCast(child, dt: AtomicType, _)
+        case u @ UpCast(child, _, _)
             if SQLConf.get.getConf(SQLConf.LEGACY_LOOSE_UPCAST) &&
+              u.dataType.isInstanceOf[AtomicType] &&
               child.dataType == StringType =>
-          Cast(child, dt.asNullable)
-
-        case UpCast(child, dataType, walkedTypePath) if 
!Cast.canUpCast(child.dataType, dataType) =>
-          fail(child, dataType, walkedTypePath)
-
-        case UpCast(child, dataType, _) => Cast(child, dataType.asNullable)
+          Cast(child, u.dataType.asNullable)
+
+        case UpCast(child, target, walkedTypePath)

Review comment:
       https://github.com/apache/spark/pull/28572/files#r427121973 and then 
let's just directly check here:
   
   ```scala
           case UpCast(child, _: DecimalType, walkedTypePath)
             if child.dataType.isInstanceOf[DecimalType] =>
   ```
   
   I guess this is what you want here?




----------------------------------------------------------------
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]



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

Reply via email to