Skip to content

Commit 61987e1

Browse files
committed
fix_issue
1 parent 0c8f0a4 commit 61987e1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

spark/src/test/scala/org/apache/comet/CometCastSuite.scala

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
720720
test("cast StringType to DecimalType(2,2)") {
721721
withSQLConf(CometConf.getExprAllowIncompatConfigKey(classOf[Cast]) -> "true") {
722722
println("testing with simple input")
723-
val values = Seq(" 3").toDF("a")
723+
val values = gen.generateStrings(dataSize, numericPattern, 12).toDF("a")
724724
Seq(true, false).foreach(ansiEnabled =>
725725
castTest(values, DataTypes.createDecimalType(2, 2), testAnsi = ansiEnabled))
726726
}
@@ -735,15 +735,21 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
735735
}
736736
}
737737

738-
test("cast StringType to DecimalType(38,10) high precision") {
738+
test("cast StringType to DecimalType(38,10) high precision - check 0 mantissa") {
739739
withSQLConf(CometConf.getExprAllowIncompatConfigKey(classOf[Cast]) -> "true") {
740-
// TODO fix for Spark 4.0.0
741-
assume(!isSpark40Plus)
742740
val values = Seq("0e31").toDF("a")
743741
Seq(true, false).foreach(ansiEnabled =>
744742
castTest(values, DataTypes.createDecimalType(38, 10), testAnsi = ansiEnabled))
745743
}
746-
}
744+
}
745+
746+
test("cast StringType to DecimalType(38,10) high precision") {
747+
withSQLConf(CometConf.getExprAllowIncompatConfigKey(classOf[Cast]) -> "true") {
748+
val values = gen.generateStrings(dataSize, numericPattern, 38).toDF("a")
749+
Seq(true, false).foreach(ansiEnabled =>
750+
castTest(values, DataTypes.createDecimalType(38, 10), testAnsi = ansiEnabled))
751+
}
752+
}
747753

748754
test("cast StringType to DecimalType(38,10) high precision - 0 mantissa") {
749755
withSQLConf(CometConf.getExprAllowIncompatConfigKey(classOf[Cast]) -> "true") {

0 commit comments

Comments
 (0)