kazuyukitanimura commented on code in PR #1385:
URL: https://github.com/apache/datafusion-comet/pull/1385#discussion_r1951776389


##########
spark/src/main/scala/org/apache/comet/expressions/CometCast.scala:
##########
@@ -70,13 +70,8 @@ object CometCast {
           case _ =>
             Unsupported
         }
-      case (from: DecimalType, to: DecimalType) =>
-        if (to.precision < from.precision) {
-          // https://github.com/apache/datafusion/issues/13492
-          Incompatible(Some("Casting to smaller precision is not supported"))
-        } else {
-          Compatible()
-        }
+      case (_: DecimalType, _: DecimalType) =>
+        Compatible()

Review Comment:
   Would you mind updating docs/source/user-guide/compatibility.md



##########
spark/src/test/scala/org/apache/comet/CometCastSuite.scala:
##########
@@ -913,8 +913,8 @@ class CometCastSuite extends CometTestBase with 
AdaptiveSparkPlanHelper {
     val values = Seq(BigDecimal("12345.6789"), BigDecimal("9876.5432"), 
BigDecimal("123.4567"))
     val df = withNulls(values)
       .toDF("b")
-      .withColumn("a", col("b").cast(DecimalType(6, 2)))
-    checkSparkAnswer(df)
+      .withColumn("a", col("b").cast(DecimalType(38, 28)))

Review Comment:
   We can create the test case like
   ```
       val rowData = Seq(
         Row(BigDecimal("12345.6789")),
         Row(BigDecimal("9876.5432")),
         Row(BigDecimal("123.4567"))
       )
       val df = spark.createDataFrame(
         spark.sparkContext.parallelize(rowData),
         StructType(Seq(StructField("a", DataTypes.createDecimalType(10,4))))
       )
   ```
   so that we can avoid to have `cast` in the input df



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to