himadripal commented on code in PR #1086: URL: https://github.com/apache/datafusion-comet/pull/1086#discussion_r1845241526
########## spark/src/test/scala/org/apache/comet/CometCastSuite.scala: ########## @@ -895,6 +895,18 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper { } } + test("cast between decimals with different precision and scale") { + // cast between default Decimal(38, 18) to Decimal(9,1) + val values = Seq(BigDecimal("12345.6789"), BigDecimal("9876.5432"), BigDecimal("123.4567")) + val df = withNulls(values).toDF("a") + castTest(df, DataTypes.createDecimalType(7, 2)) Review Comment: This is the result of the test with (6,2) - on the right ( spark answer), the converted (precision,scale) is (7,2) for the last row and left side is matching with the issue description value. Should the left side produce `12345.68` instead of null? ```scala == Results == !== Correct Answer - 4 == == Spark Answer - 4 == struct<a:decimal(38,18),a:decimal(6,2)> struct<a:decimal(38,18),a:decimal(6,2)> [null,null] [null,null] [123.456700000000000000,123.46] [123.456700000000000000,123.46] [9876.543200000000000000,9876.54] [9876.543200000000000000,9876.54] ![12345.678900000000000000,null] [12345.678900000000000000,12345.68] ``` -- 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