@@ -678,22 +678,32 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
678678 " xyz" ,
679679 null )
680680
681- test(" cast StringType to FloatType" ) {
681+ test(" cast StringType to FloatType special values " ) {
682682 Seq (true , false ).foreach { v =>
683683 castTest(specialValues.toDF(" a" ), DataTypes .FloatType , testAnsi = v)
684684 }
685+ }
685686
687+ test(" cast StringType to DoubleType special values" ) {
688+ Seq (true , false ).foreach { v =>
689+ castTest(specialValues.toDF(" a" ), DataTypes .DoubleType , testAnsi = v)
690+ }
686691 }
687692
688693 test(" cast StringType to DoubleType" ) {
689694 Seq (true , false ).foreach { v =>
690- castTest(specialValues.toDF(" a" ), DataTypes .DoubleType , testAnsi = v)
695+ castTest(gen.generateStrings(dataSize, numericPattern, 10 ).toDF(" a" ), DataTypes .DoubleType , testAnsi = v)
696+ }
697+ }
698+
699+ test(" cast StringType to FloatType" ) {
700+ Seq (true , false ).foreach { v =>
701+ castTest(gen.generateStrings(dataSize, numericPattern, 10 ).toDF(" a" ), DataTypes .FloatType , testAnsi = v)
691702 }
692703 }
693704
694- test(" cast StringType to DecimalType(10,2) fuzz" ) {
695- // https://github.com/apache/datafusion-comet/issues/325
696- val values = gen.generateStrings(dataSize, numericPattern, 8 ).toDF(" a" )
705+ test(" cast StringType to DecimalType(10,2)" ) {
706+ val values = gen.generateStrings(dataSize, numericPattern, 12 ).toDF(" a" )
697707 castTest(values, DataTypes .createDecimalType(10 , 2 ))
698708 }
699709
@@ -768,17 +778,6 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
768778 castTest(values, DataTypes .createDecimalType(23 , 8 ), testAnsi = k))
769779 }
770780
771- test(" cast StringType to DecimalType(10,2)" ) {
772- withSQLConf(SQLConf .ANSI_ENABLED .key -> " false" ) {
773- val values = gen
774- .generateStrings(dataSize, " 0123456789." , 8 )
775- .filter(_.exists(_.isDigit))
776- .toDF(" a" )
777- Seq (true , false ).foreach(k =>
778- castTest(values, DataTypes .createDecimalType(10 , 2 ), testAnsi = k))
779- }
780- }
781-
782781 test(" cast StringType to BinaryType" ) {
783782 castTest(gen.generateStrings(dataSize, numericPattern, 8 ).toDF(" a" ), DataTypes .BinaryType )
784783 }
0 commit comments