From 3a464601de54f9fab6a362c4c9fa93747de4c65d Mon Sep 17 00:00:00 2001 From: Kazuyuki Tanimura Date: Mon, 30 Mar 2026 19:25:15 -0700 Subject: [PATCH 1/7] test: ceil and floor works correctly for Decimal128 --- native/spark-expr/src/math_funcs/ceil.rs | 7 +++--- native/spark-expr/src/math_funcs/floor.rs | 7 +++--- .../scala/org/apache/comet/serde/math.scala | 24 ------------------- .../apache/comet/CometExpressionSuite.scala | 4 ++++ 4 files changed, 10 insertions(+), 32 deletions(-) diff --git a/native/spark-expr/src/math_funcs/ceil.rs b/native/spark-expr/src/math_funcs/ceil.rs index b5bc1c31bd..e1f0e69e5f 100644 --- a/native/spark-expr/src/math_funcs/ceil.rs +++ b/native/spark-expr/src/math_funcs/ceil.rs @@ -164,7 +164,6 @@ mod test { // https://github.com/apache/datafusion-comet/issues/1729 #[test] - #[ignore] fn test_ceil_decimal128_array() -> Result<()> { let array = Decimal128Array::from(vec![ Some(12345), // 123.45 @@ -178,9 +177,9 @@ mod test { unreachable!() }; let expected = Decimal128Array::from(vec![ - Some(12400), // 124.00 - Some(12500), // 125.00 - Some(-12900), // -129.00 + Some(124), // 124.00 + Some(125), // 125.00 + Some(-129), // -129.00 None, ]) .with_precision_and_scale(5, 2)?; diff --git a/native/spark-expr/src/math_funcs/floor.rs b/native/spark-expr/src/math_funcs/floor.rs index 2028000e19..5cb1f16e3b 100644 --- a/native/spark-expr/src/math_funcs/floor.rs +++ b/native/spark-expr/src/math_funcs/floor.rs @@ -164,7 +164,6 @@ mod test { // https://github.com/apache/datafusion-comet/issues/1729 #[test] - #[ignore] fn test_floor_decimal128_array() -> Result<()> { let array = Decimal128Array::from(vec![ Some(12345), // 123.45 @@ -178,9 +177,9 @@ mod test { unreachable!() }; let expected = Decimal128Array::from(vec![ - Some(12300), // 123.00 - Some(12500), // 125.00 - Some(-13000), // -130.00 + Some(123), // 123.00 + Some(125), // 125.00 + Some(-130), // -130.00 None, ]) .with_precision_and_scale(5, 2)?; diff --git a/spark/src/main/scala/org/apache/comet/serde/math.scala b/spark/src/main/scala/org/apache/comet/serde/math.scala index 5a0393142a..ddc953857d 100644 --- a/spark/src/main/scala/org/apache/comet/serde/math.scala +++ b/spark/src/main/scala/org/apache/comet/serde/math.scala @@ -38,18 +38,6 @@ object CometAtan2 extends CometExpressionSerde[Atan2] { } object CometCeil extends CometExpressionSerde[Ceil] { - - override def getSupportLevel(expr: Ceil): SupportLevel = { - expr.child.dataType match { - case _: DecimalType => - Incompatible( - Some( - "Incorrect results for Decimal type inputs" + - " (https://github.com/apache/datafusion-comet/issues/1729)")) - case _ => Compatible() - } - } - override def convert( expr: Ceil, inputs: Seq[Attribute], @@ -70,18 +58,6 @@ object CometCeil extends CometExpressionSerde[Ceil] { } object CometFloor extends CometExpressionSerde[Floor] { - - override def getSupportLevel(expr: Floor): SupportLevel = { - expr.child.dataType match { - case _: DecimalType => - Incompatible( - Some( - "Incorrect results for Decimal type inputs" + - " (https://github.com/apache/datafusion-comet/issues/1729)")) - case _ => Compatible() - } - } - override def convert( expr: Floor, inputs: Seq[Attribute], diff --git a/spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala b/spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala index 9fdd5a6777..8aa88d615b 100644 --- a/spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala +++ b/spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala @@ -1487,6 +1487,10 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper { checkSparkAnswerAndOperator(s"SELECT floor(cast(${n} as decimal(38, 18))) FROM tbl") checkSparkAnswerAndOperator(s"SELECT floor(cast(${n} as decimal(20, 0))) FROM tbl") } + for (n <- Seq("123.45", "125.00", "-129.99")) { + checkSparkAnswerAndOperator(s"SELECT ceil(cast(${n} as decimal(5, 2))) FROM tbl") + checkSparkAnswerAndOperator(s"SELECT floor(cast(${n} as decimal(5, 2))) FROM tbl") + } } } } From ae9fab27264a4fe0b5e5935e11b240f65ce21fa5 Mon Sep 17 00:00:00 2001 From: Kazuyuki Tanimura Date: Mon, 30 Mar 2026 23:13:22 -0700 Subject: [PATCH 2/7] doc --- docs/source/user-guide/latest/compatibility.md | 2 -- docs/source/user-guide/latest/expressions.md | 4 ++-- spark/src/test/resources/sql-tests/expressions/math/ceil.sql | 1 - spark/src/test/resources/sql-tests/expressions/math/floor.sql | 1 - .../test/scala/org/apache/comet/CometExpressionSuite.scala | 4 +--- 5 files changed, 3 insertions(+), 9 deletions(-) diff --git a/docs/source/user-guide/latest/compatibility.md b/docs/source/user-guide/latest/compatibility.md index 3ec6656187..a5a424e858 100644 --- a/docs/source/user-guide/latest/compatibility.md +++ b/docs/source/user-guide/latest/compatibility.md @@ -86,8 +86,6 @@ the [Comet Supported Expressions Guide](expressions.md) for more information on ### Math Expressions -- **Ceil, Floor**: Incorrect results for Decimal type inputs. - [#1729](https://github.com/apache/datafusion-comet/issues/1729) - **Tan**: `tan(-0.0)` produces `0.0` instead of `-0.0`. [#1897](https://github.com/apache/datafusion-comet/issues/1897) diff --git a/docs/source/user-guide/latest/expressions.md b/docs/source/user-guide/latest/expressions.md index c3aca6f67a..ed8083c0e1 100644 --- a/docs/source/user-guide/latest/expressions.md +++ b/docs/source/user-guide/latest/expressions.md @@ -130,14 +130,14 @@ Expressions that are not Spark-compatible will fall back to Spark by default and | Atan | `atan` | Yes | | | Atan2 | `atan2` | Yes | | | BRound | `bround` | Yes | | -| Ceil | `ceil` | No | Incorrect results for Decimal type inputs ([#1729](https://github.com/apache/datafusion-comet/issues/1729)) | +| Ceil | `ceil` | No | | | Cos | `cos` | Yes | | | Cosh | `cosh` | Yes | | | Cot | `cot` | Yes | | | Divide | `/` | Yes | | | Exp | `exp` | Yes | | | Expm1 | `expm1` | Yes | | -| Floor | `floor` | No | Incorrect results for Decimal type inputs ([#1729](https://github.com/apache/datafusion-comet/issues/1729)) | +| Floor | `floor` | No | | | Hex | `hex` | Yes | | | IntegralDivide | `div` | Yes | | | IsNaN | `isnan` | Yes | | diff --git a/spark/src/test/resources/sql-tests/expressions/math/ceil.sql b/spark/src/test/resources/sql-tests/expressions/math/ceil.sql index c11c42bedb..fade75d28a 100644 --- a/spark/src/test/resources/sql-tests/expressions/math/ceil.sql +++ b/spark/src/test/resources/sql-tests/expressions/math/ceil.sql @@ -15,7 +15,6 @@ -- specific language governing permissions and limitations -- under the License. --- Config: spark.comet.expression.Ceil.allowIncompatible=true -- ConfigMatrix: parquet.enable.dictionary=false,true statement diff --git a/spark/src/test/resources/sql-tests/expressions/math/floor.sql b/spark/src/test/resources/sql-tests/expressions/math/floor.sql index 62fa2a4045..3960002846 100644 --- a/spark/src/test/resources/sql-tests/expressions/math/floor.sql +++ b/spark/src/test/resources/sql-tests/expressions/math/floor.sql @@ -15,7 +15,6 @@ -- specific language governing permissions and limitations -- under the License. --- Config: spark.comet.expression.Floor.allowIncompatible=true -- ConfigMatrix: parquet.enable.dictionary=false,true statement diff --git a/spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala b/spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala index 8aa88d615b..739ec66f3d 100644 --- a/spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala +++ b/spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala @@ -1445,9 +1445,7 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper { test("ceil and floor") { Seq("true", "false").foreach { dictionary => withSQLConf( - "parquet.enable.dictionary" -> dictionary, - CometConf.getExprAllowIncompatConfigKey(classOf[Ceil]) -> "true", - CometConf.getExprAllowIncompatConfigKey(classOf[Floor]) -> "true") { + "parquet.enable.dictionary" -> dictionary) { withParquetTable( (-5 until 5).map(i => (i.toDouble + 0.3, i.toDouble + 0.8)), "tbl", From a621e6c66d7c14c951fb0cd6b7aa16b7d82e3819 Mon Sep 17 00:00:00 2001 From: Kazuyuki Tanimura Date: Mon, 30 Mar 2026 23:27:40 -0700 Subject: [PATCH 3/7] format --- .../test/scala/org/apache/comet/CometExpressionSuite.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala b/spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala index 739ec66f3d..1e66c9f599 100644 --- a/spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala +++ b/spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala @@ -28,7 +28,7 @@ import org.scalatest.Tag import org.apache.hadoop.fs.Path import org.apache.spark.sql.{CometTestBase, DataFrame, Row} -import org.apache.spark.sql.catalyst.expressions.{Alias, Cast, Ceil, Floor, FromUnixTime, Literal, StructsToJson, Tan, TruncDate, TruncTimestamp} +import org.apache.spark.sql.catalyst.expressions.{Alias, Cast, FromUnixTime, Literal, StructsToJson, Tan, TruncDate, TruncTimestamp} import org.apache.spark.sql.catalyst.optimizer.SimplifyExtractValueOps import org.apache.spark.sql.comet.CometProjectExec import org.apache.spark.sql.execution.{ProjectExec, SparkPlan} @@ -1444,8 +1444,7 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper { test("ceil and floor") { Seq("true", "false").foreach { dictionary => - withSQLConf( - "parquet.enable.dictionary" -> dictionary) { + withSQLConf("parquet.enable.dictionary" -> dictionary) { withParquetTable( (-5 until 5).map(i => (i.toDouble + 0.3, i.toDouble + 0.8)), "tbl", From 7a38e50d18551892db44ecc65232a39318913613 Mon Sep 17 00:00:00 2001 From: Kazuyuki Tanimura Date: Mon, 30 Mar 2026 23:34:11 -0700 Subject: [PATCH 4/7] doc --- docs/source/user-guide/latest/expressions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/user-guide/latest/expressions.md b/docs/source/user-guide/latest/expressions.md index ed8083c0e1..c015995ba3 100644 --- a/docs/source/user-guide/latest/expressions.md +++ b/docs/source/user-guide/latest/expressions.md @@ -130,14 +130,14 @@ Expressions that are not Spark-compatible will fall back to Spark by default and | Atan | `atan` | Yes | | | Atan2 | `atan2` | Yes | | | BRound | `bround` | Yes | | -| Ceil | `ceil` | No | | +| Ceil | `ceil` | Yes | | | Cos | `cos` | Yes | | | Cosh | `cosh` | Yes | | | Cot | `cot` | Yes | | | Divide | `/` | Yes | | | Exp | `exp` | Yes | | | Expm1 | `expm1` | Yes | | -| Floor | `floor` | No | | +| Floor | `floor` | Yes | | | Hex | `hex` | Yes | | | IntegralDivide | `div` | Yes | | | IsNaN | `isnan` | Yes | | From 5d32163c5882a7af9be01cc94bf092107fa39c06 Mon Sep 17 00:00:00 2001 From: Kazuyuki Tanimura Date: Mon, 30 Mar 2026 23:41:14 -0700 Subject: [PATCH 5/7] doc --- docs/source/user-guide/latest/expressions.md | 84 ++++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/docs/source/user-guide/latest/expressions.md b/docs/source/user-guide/latest/expressions.md index c015995ba3..c932e23f0e 100644 --- a/docs/source/user-guide/latest/expressions.md +++ b/docs/source/user-guide/latest/expressions.md @@ -121,48 +121,48 @@ Expressions that are not Spark-compatible will fall back to Spark by default and ## Math Expressions -| Expression | SQL | Spark-Compatible? | Compatibility Notes | -| -------------- | --------- | ----------------- | ----------------------------------------------------------------------------------------------------------- | -| Abs | `abs` | Yes | | -| Acos | `acos` | Yes | | -| Add | `+` | Yes | | -| Asin | `asin` | Yes | | -| Atan | `atan` | Yes | | -| Atan2 | `atan2` | Yes | | -| BRound | `bround` | Yes | | -| Ceil | `ceil` | Yes | | -| Cos | `cos` | Yes | | -| Cosh | `cosh` | Yes | | -| Cot | `cot` | Yes | | -| Divide | `/` | Yes | | -| Exp | `exp` | Yes | | -| Expm1 | `expm1` | Yes | | -| Floor | `floor` | Yes | | -| Hex | `hex` | Yes | | -| IntegralDivide | `div` | Yes | | -| IsNaN | `isnan` | Yes | | -| Log | `log` | Yes | | -| Log2 | `log2` | Yes | | -| Log10 | `log10` | Yes | | -| Multiply | `*` | Yes | | -| Pow | `power` | Yes | | -| Rand | `rand` | Yes | | -| Randn | `randn` | Yes | | -| Remainder | `%` | Yes | | -| Round | `round` | Yes | | -| Signum | `signum` | Yes | | -| Sin | `sin` | Yes | | -| Sinh | `sinh` | Yes | | -| Sqrt | `sqrt` | Yes | | -| Subtract | `-` | Yes | | -| Tan | `tan` | No | tan(-0.0) produces incorrect result ([#1897](https://github.com/apache/datafusion-comet/issues/1897)) | -| Tanh | `tanh` | Yes | | -| TryAdd | `try_add` | Yes | Only integer inputs are supported | -| TryDivide | `try_div` | Yes | Only integer inputs are supported | -| TryMultiply | `try_mul` | Yes | Only integer inputs are supported | -| TrySubtract | `try_sub` | Yes | Only integer inputs are supported | -| UnaryMinus | `-` | Yes | | -| Unhex | `unhex` | Yes | | +| Expression | SQL | Spark-Compatible? | Compatibility Notes | +| -------------- | --------- | ----------------- | ----------------------------------------------------------------------------------------------------- | +| Abs | `abs` | Yes | | +| Acos | `acos` | Yes | | +| Add | `+` | Yes | | +| Asin | `asin` | Yes | | +| Atan | `atan` | Yes | | +| Atan2 | `atan2` | Yes | | +| BRound | `bround` | Yes | | +| Ceil | `ceil` | Yes | | +| Cos | `cos` | Yes | | +| Cosh | `cosh` | Yes | | +| Cot | `cot` | Yes | | +| Divide | `/` | Yes | | +| Exp | `exp` | Yes | | +| Expm1 | `expm1` | Yes | | +| Floor | `floor` | Yes | | +| Hex | `hex` | Yes | | +| IntegralDivide | `div` | Yes | | +| IsNaN | `isnan` | Yes | | +| Log | `log` | Yes | | +| Log2 | `log2` | Yes | | +| Log10 | `log10` | Yes | | +| Multiply | `*` | Yes | | +| Pow | `power` | Yes | | +| Rand | `rand` | Yes | | +| Randn | `randn` | Yes | | +| Remainder | `%` | Yes | | +| Round | `round` | Yes | | +| Signum | `signum` | Yes | | +| Sin | `sin` | Yes | | +| Sinh | `sinh` | Yes | | +| Sqrt | `sqrt` | Yes | | +| Subtract | `-` | Yes | | +| Tan | `tan` | No | tan(-0.0) produces incorrect result ([#1897](https://github.com/apache/datafusion-comet/issues/1897)) | +| Tanh | `tanh` | Yes | | +| TryAdd | `try_add` | Yes | Only integer inputs are supported | +| TryDivide | `try_div` | Yes | Only integer inputs are supported | +| TryMultiply | `try_mul` | Yes | Only integer inputs are supported | +| TrySubtract | `try_sub` | Yes | Only integer inputs are supported | +| UnaryMinus | `-` | Yes | | +| Unhex | `unhex` | Yes | | ## Hashing Functions From 2f76fe3ebe64daf2c4586135f1ca59e95d4f1196 Mon Sep 17 00:00:00 2001 From: Kazuyuki Tanimura Date: Tue, 31 Mar 2026 09:25:38 -0700 Subject: [PATCH 6/7] address review comments --- native/spark-expr/src/math_funcs/ceil.rs | 13 +++++-------- native/spark-expr/src/math_funcs/floor.rs | 13 +++++-------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/native/spark-expr/src/math_funcs/ceil.rs b/native/spark-expr/src/math_funcs/ceil.rs index e1f0e69e5f..324a118fcb 100644 --- a/native/spark-expr/src/math_funcs/ceil.rs +++ b/native/spark-expr/src/math_funcs/ceil.rs @@ -162,7 +162,6 @@ mod test { Ok(()) } - // https://github.com/apache/datafusion-comet/issues/1729 #[test] fn test_ceil_decimal128_array() -> Result<()> { let array = Decimal128Array::from(vec![ @@ -173,7 +172,7 @@ mod test { ]) .with_precision_and_scale(5, 2)?; let args = vec![ColumnarValue::Array(Arc::new(array))]; - let ColumnarValue::Array(result) = spark_ceil(&args, &DataType::Decimal128(5, 2))? else { + let ColumnarValue::Array(result) = spark_ceil(&args, &DataType::Decimal128(4, 0))? else { unreachable!() }; let expected = Decimal128Array::from(vec![ @@ -182,7 +181,7 @@ mod test { Some(-129), // -129.00 None, ]) - .with_precision_and_scale(5, 2)?; + .with_precision_and_scale(4, 0)?; let actual = result.as_any().downcast_ref::().unwrap(); assert_eq!(actual, &expected); Ok(()) @@ -224,21 +223,19 @@ mod test { Ok(()) } - // https://github.com/apache/datafusion-comet/issues/1729 #[test] - #[ignore] fn test_ceil_decimal128_scalar() -> Result<()> { let args = vec![ColumnarValue::Scalar(ScalarValue::Decimal128( Some(567), 3, 1, ))]; // 56.7 - let ColumnarValue::Scalar(ScalarValue::Decimal128(Some(result), 3, 1)) = - spark_ceil(&args, &DataType::Decimal128(3, 1))? + let ColumnarValue::Scalar(ScalarValue::Decimal128(Some(result), 3, 0)) = + spark_ceil(&args, &DataType::Decimal128(3, 0))? else { unreachable!() }; - assert_eq!(result, 570); // 57.0 + assert_eq!(result, 57); // 57.0 Ok(()) } } diff --git a/native/spark-expr/src/math_funcs/floor.rs b/native/spark-expr/src/math_funcs/floor.rs index 5cb1f16e3b..c7c1c9e904 100644 --- a/native/spark-expr/src/math_funcs/floor.rs +++ b/native/spark-expr/src/math_funcs/floor.rs @@ -162,7 +162,6 @@ mod test { Ok(()) } - // https://github.com/apache/datafusion-comet/issues/1729 #[test] fn test_floor_decimal128_array() -> Result<()> { let array = Decimal128Array::from(vec![ @@ -173,7 +172,7 @@ mod test { ]) .with_precision_and_scale(5, 2)?; let args = vec![ColumnarValue::Array(Arc::new(array))]; - let ColumnarValue::Array(result) = spark_floor(&args, &DataType::Decimal128(5, 2))? else { + let ColumnarValue::Array(result) = spark_floor(&args, &DataType::Decimal128(4, 0))? else { unreachable!() }; let expected = Decimal128Array::from(vec![ @@ -182,7 +181,7 @@ mod test { Some(-130), // -130.00 None, ]) - .with_precision_and_scale(5, 2)?; + .with_precision_and_scale(4, 0)?; let actual = result.as_any().downcast_ref::().unwrap(); assert_eq!(actual, &expected); Ok(()) @@ -224,21 +223,19 @@ mod test { Ok(()) } - // https://github.com/apache/datafusion-comet/issues/1729 #[test] - #[ignore] fn test_floor_decimal128_scalar() -> Result<()> { let args = vec![ColumnarValue::Scalar(ScalarValue::Decimal128( Some(567), 3, 1, ))]; // 56.7 - let ColumnarValue::Scalar(ScalarValue::Decimal128(Some(result), 3, 1)) = - spark_floor(&args, &DataType::Decimal128(3, 1))? + let ColumnarValue::Scalar(ScalarValue::Decimal128(Some(result), 3, 0)) = + spark_floor(&args, &DataType::Decimal128(3, 0))? else { unreachable!() }; - assert_eq!(result, 560); // 56.0 + assert_eq!(result, 56); // 56.0 Ok(()) } } From d83b4864aaeed2d8b1d472303f15aab932f051e5 Mon Sep 17 00:00:00 2001 From: Kazuyuki Tanimura Date: Thu, 2 Apr 2026 09:23:08 -0700 Subject: [PATCH 7/7] address review comments --- .../test/resources/sql-tests/expressions/math/ceil.sql | 8 ++++---- .../test/resources/sql-tests/expressions/math/floor.sql | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spark/src/test/resources/sql-tests/expressions/math/ceil.sql b/spark/src/test/resources/sql-tests/expressions/math/ceil.sql index fade75d28a..a0fa163361 100644 --- a/spark/src/test/resources/sql-tests/expressions/math/ceil.sql +++ b/spark/src/test/resources/sql-tests/expressions/math/ceil.sql @@ -18,14 +18,14 @@ -- ConfigMatrix: parquet.enable.dictionary=false,true statement -CREATE TABLE test_ceil(f float, d double) USING parquet +CREATE TABLE test_ceil(f float, d double, dec DECIMAL(5, 2)) USING parquet statement -INSERT INTO test_ceil VALUES (1.1, 1.1), (-1.1, -1.1), (0.0, 0.0), (1.0, 1.0), (NULL, NULL), (cast('NaN' as float), cast('NaN' as double)), (cast('Infinity' as float), cast('Infinity' as double)) +INSERT INTO test_ceil VALUES (1.1, 1.1, 1.10), (-1.1, -1.1, -1.10), (0.0, 0.0, 0.00), (1.0, 1.0, 1.00), (NULL, NULL, NULL), (cast('NaN' as float), cast('NaN' as double), NULL), (cast('Infinity' as float), cast('Infinity' as double), NULL) query -SELECT ceil(f), ceil(d) FROM test_ceil +SELECT ceil(f), ceil(d), ceil(dec) FROM test_ceil -- literal arguments query -SELECT ceil(1.1), ceil(-1.1), ceil(0.0), ceil(NULL) +SELECT ceil(1.1), ceil(-1.1), ceil(0.0), ceil(NULL), ceil(cast(1.10 as DECIMAL(5, 2))), ceil(cast(-1.10 as DECIMAL(5, 2))) diff --git a/spark/src/test/resources/sql-tests/expressions/math/floor.sql b/spark/src/test/resources/sql-tests/expressions/math/floor.sql index 3960002846..fd59dc6857 100644 --- a/spark/src/test/resources/sql-tests/expressions/math/floor.sql +++ b/spark/src/test/resources/sql-tests/expressions/math/floor.sql @@ -18,14 +18,14 @@ -- ConfigMatrix: parquet.enable.dictionary=false,true statement -CREATE TABLE test_floor(f float, d double) USING parquet +CREATE TABLE test_floor(f float, d double, dec DECIMAL(5, 2)) USING parquet statement -INSERT INTO test_floor VALUES (1.9, 1.9), (-1.1, -1.1), (0.0, 0.0), (1.0, 1.0), (NULL, NULL), (cast('NaN' as float), cast('NaN' as double)), (cast('Infinity' as float), cast('Infinity' as double)) +INSERT INTO test_floor VALUES (1.9, 1.9, 1.90), (-1.1, -1.1, -1.10), (0.0, 0.0, 0.00), (1.0, 1.0, 1.00), (NULL, NULL, NULL), (cast('NaN' as float), cast('NaN' as double), NULL), (cast('Infinity' as float), cast('Infinity' as double), NULL) query -SELECT floor(f), floor(d) FROM test_floor +SELECT floor(f), floor(d), floor(dec) FROM test_floor -- literal arguments query -SELECT floor(1.9), floor(-1.1), floor(0.0), floor(NULL) +SELECT floor(1.9), floor(-1.1), floor(0.0), floor(NULL), floor(cast(1.90 as DECIMAL(5, 2))), floor(cast(-1.10 as DECIMAL(5, 2)))