gengliangwang commented on a change in pull request #33775:
URL: https://github.com/apache/spark/pull/33775#discussion_r690938927



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/AnsiTypeCoercion.scala
##########
@@ -178,6 +178,11 @@ object AnsiTypeCoercion extends TypeCoercionBase {
       case (StringType, DecimalType) if isInputFoldable =>
         Some(DecimalType.SYSTEM_DEFAULT)
 
+      // If the target type is Decimal type with precision greater than 11 and 
scale is 6,
+      // cast the input to decimal.
+      case (_: IntegerType, t: DecimalType) if (t.precision > 11 && t.scale == 
6) =>

Review comment:
       ```suggestion
         case (n: NumericType, t: DecimalType) if t.isWiderThan(n) =>
   ```

##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/AnsiTypeCoercion.scala
##########
@@ -178,6 +178,11 @@ object AnsiTypeCoercion extends TypeCoercionBase {
       case (StringType, DecimalType) if isInputFoldable =>
         Some(DecimalType.SYSTEM_DEFAULT)
 
+      // If the target type is Decimal type with precision greater than 11 and 
scale is 6,
+      // cast the input to decimal.
+      case (_: IntegerType, t: DecimalType) if (t.precision > 11 && t.scale == 
6) =>

Review comment:
       Let's make it more general 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.

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]

Reply via email to