andygrove commented on code in PR #3248:
URL: https://github.com/apache/datafusion-comet/pull/3248#discussion_r2718971094
##########
spark/src/test/scala/org/apache/comet/CometCastSuite.scala:
##########
@@ -719,19 +719,43 @@ class CometCastSuite extends CometTestBase with
AdaptiveSparkPlanHelper {
test("cast StringType to DecimalType(2,2)") {
withSQLConf(CometConf.getExprAllowIncompatConfigKey(classOf[Cast]) ->
"true") {
- // TODO fix for Spark 4.0.0
- assume(!isSpark40Plus)
+ println("testing with simple input")
val values = gen.generateStrings(dataSize, numericPattern, 12).toDF("a")
Seq(true, false).foreach(ansiEnabled =>
castTest(values, DataTypes.createDecimalType(2, 2), testAnsi =
ansiEnabled))
}
}
+ test("cast StringType to DecimalType(2,2) check if right exception is being
thrown") {
+ withSQLConf(CometConf.getExprAllowIncompatConfigKey(classOf[Cast]) ->
"true") {
+ println("testing with simple input")
+ val values = Seq(" 3").toDF("a")
+ Seq(true, false).foreach(ansiEnabled =>
+ castTest(values, DataTypes.createDecimalType(2, 2), testAnsi =
ansiEnabled))
+ }
+ }
+
+ test("cast StringType to DecimalType(38,10) high precision - check 0
mantissa") {
+ withSQLConf(CometConf.getExprAllowIncompatConfigKey(classOf[Cast]) ->
"true") {
+ val values = Seq("0e31").toDF("a")
+ Seq(true, false).foreach(ansiEnabled =>
+ castTest(values, DataTypes.createDecimalType(38, 10), testAnsi =
ansiEnabled))
+ }
+ }
+
test("cast StringType to DecimalType(38,10) high precision") {
+ withSQLConf(CometConf.getExprAllowIncompatConfigKey(classOf[Cast]) ->
"true") {
+ val values = gen.generateStrings(dataSize, numericPattern, 38).toDF("a")
+ Seq(true, false).foreach(ansiEnabled =>
+ castTest(values, DataTypes.createDecimalType(38, 10), testAnsi =
ansiEnabled))
+ }
+ }
+
+ test("cast StringType to DecimalType(38,10) high precision - 0 mantissa") {
withSQLConf(CometConf.getExprAllowIncompatConfigKey(classOf[Cast]) ->
"true") {
// TODO fix for Spark 4.0.0
assume(!isSpark40Plus)
- val values = gen.generateStrings(dataSize, numericPattern, 38).toDF("a")
+ val values = Seq("0e31").toDF("a")
Review Comment:
This change seems to reduce test coverage?
--
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]