coderfender commented on code in PR #2835:
URL: https://github.com/apache/datafusion-comet/pull/2835#discussion_r2641670977
##########
spark/src/test/scala/org/apache/comet/CometCastSuite.scala:
##########
@@ -652,54 +678,61 @@ class CometCastSuite extends CometTestBase with
AdaptiveSparkPlanHelper {
castTest(gen.generateStrings(dataSize, numericPattern, 8).toDF("a"),
DataTypes.LongType)
}
- ignore("cast StringType to FloatType") {
- // https://github.com/apache/datafusion-comet/issues/326
- castTest(gen.generateStrings(dataSize, numericPattern, 8).toDF("a"),
DataTypes.FloatType)
- }
-
- test("cast StringType to FloatType (partial support)") {
- withSQLConf(
- CometConf.getExprAllowIncompatConfigKey(classOf[Cast]) -> "true",
- SQLConf.ANSI_ENABLED.key -> "false") {
- castTest(
- gen.generateStrings(dataSize, "0123456789.", 8).toDF("a"),
- DataTypes.FloatType,
- testAnsi = false)
+ test("cast StringType to FloatType special values") {
+ // TODO fix for Spark 4.0.0
+ assume(!isSpark40Plus)
Review Comment:
We had an issue with Spark4x message matching but it got resolved with this
PR : https://github.com/apache/datafusion-comet/pull/2919
##########
native/spark-expr/src/conversion_funcs/cast.rs:
##########
@@ -1058,6 +1053,84 @@ fn cast_array(
Ok(spark_cast_postprocess(cast_result?, from_type, to_type))
}
+fn cast_string_to_float(
+ array: &ArrayRef,
+ to_type: &DataType,
+ eval_mode: EvalMode,
+) -> SparkResult<ArrayRef> {
+ match to_type {
+ DataType::Float16 | DataType::Float32 => {
Review Comment:
Thank you . I fixed the code to not support `Float16`
##########
spark/src/test/scala/org/apache/comet/CometCastSuite.scala:
##########
@@ -652,54 +678,61 @@ class CometCastSuite extends CometTestBase with
AdaptiveSparkPlanHelper {
castTest(gen.generateStrings(dataSize, numericPattern, 8).toDF("a"),
DataTypes.LongType)
}
- ignore("cast StringType to FloatType") {
- // https://github.com/apache/datafusion-comet/issues/326
- castTest(gen.generateStrings(dataSize, numericPattern, 8).toDF("a"),
DataTypes.FloatType)
- }
-
- test("cast StringType to FloatType (partial support)") {
- withSQLConf(
- CometConf.getExprAllowIncompatConfigKey(classOf[Cast]) -> "true",
- SQLConf.ANSI_ENABLED.key -> "false") {
- castTest(
- gen.generateStrings(dataSize, "0123456789.", 8).toDF("a"),
- DataTypes.FloatType,
- testAnsi = false)
+ test("cast StringType to FloatType special values") {
+ // TODO fix for Spark 4.0.0
+ assume(!isSpark40Plus)
+ Seq(true, false).foreach { v =>
+ castTest(specialValues.toDF("a"), DataTypes.FloatType, testAnsi = v)
}
}
- ignore("cast StringType to DoubleType") {
- // https://github.com/apache/datafusion-comet/issues/326
- castTest(gen.generateStrings(dataSize, numericPattern, 8).toDF("a"),
DataTypes.DoubleType)
+ test("cast StringType to DoubleType special values") {
+ // TODO fix for Spark 4.0.0
+ assume(!isSpark40Plus)
+ Seq(true, false).foreach { v =>
Review Comment:
Thank you . I changed the name of the running variable
--
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]