From 767637276f760324b0281fc8b075305ef369dc82 Mon Sep 17 00:00:00 2001 From: Kazuyuki Tanimura Date: Fri, 27 Mar 2026 14:43:14 -0700 Subject: [PATCH] test: cast negative zero to string --- docs/source/user-guide/latest/compatibility.md | 7 ------- spark/src/test/scala/org/apache/comet/CometCastSuite.scala | 6 ++++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/source/user-guide/latest/compatibility.md b/docs/source/user-guide/latest/compatibility.md index 3ec6656187..e0bc5f06ee 100644 --- a/docs/source/user-guide/latest/compatibility.md +++ b/docs/source/user-guide/latest/compatibility.md @@ -153,13 +153,6 @@ Cast operations in Comet fall into three levels of support: Spark. - **N/A**: Spark does not support this cast. -### Negative Zero - -When casting floating-point values to strings, Spark normalizes negative zero (`-0.0`) to `"0.0"`, but Comet -may produce `"-0.0"`. Since negative zero and positive zero are semantically equivalent (`-0.0 == 0.0` is true -in IEEE 754), this difference is unlikely to affect real-world results. See -[#1036](https://github.com/apache/datafusion-comet/issues/1036) for more details. - ### Legacy Mode diff --git a/spark/src/test/scala/org/apache/comet/CometCastSuite.scala b/spark/src/test/scala/org/apache/comet/CometCastSuite.scala index d1d00e3398..9a0d421020 100644 --- a/spark/src/test/scala/org/apache/comet/CometCastSuite.scala +++ b/spark/src/test/scala/org/apache/comet/CometCastSuite.scala @@ -498,6 +498,7 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper { -1.0f, Short.MinValue.toFloat, Short.MaxValue.toFloat, + -0.0f, 0.0f) ++ Range(0, dataSize).map(_ => r.nextFloat()) castTest(withNulls(values).toDF("a"), DataTypes.StringType) @@ -558,6 +559,11 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper { Double.NaN, Double.PositiveInfinity, Double.NegativeInfinity, + 1.0d, + -1.0d, + Int.MinValue.toDouble, + Int.MaxValue.toDouble, + -0.0d, 0.0d) ++ Range(0, dataSize).map(_ => r.nextDouble()) castTest(withNulls(values).toDF("a"), DataTypes.StringType)