You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/09/14 15:21:59 UTC

(datafusion-comet) 01/01: test: cover round expression routing configurations (#5878)

This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-5878-b4671d18d00590f4da4734392e20481f17cd390b
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git

commit d95a18b712c9734e7526afbe45b9ec5f3b381ec7
Author: KUAN-HAO HUANG <10...@users.noreply.github.com>
AuthorDate: Mon Sep 14 14:04:51 2026 +0000

    test: cover round expression routing configurations (#5878)
    
    * test: cover round expression routing configurations
    
    * test: refine round routing coverage after review
---
 .../resources/sql-tests/expressions/math/round.sql | 10 ++++--
 .../expressions/math/round_dispatch_disabled.sql   | 37 ++++++++++++++++++++++
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/spark/src/test/resources/sql-tests/expressions/math/round.sql b/spark/src/test/resources/sql-tests/expressions/math/round.sql
index 971ad0a4d5..1f3bd3d9e6 100644
--- a/spark/src/test/resources/sql-tests/expressions/math/round.sql
+++ b/spark/src/test/resources/sql-tests/expressions/math/round.sql
@@ -15,6 +15,8 @@
 -- specific language governing permissions and limitations
 -- under the License.
 
+-- Config: spark.comet.exec.scalaUDF.codegen.enabled=true
+
 -- Integral and non-negative-scale decimal inputs round natively. Float and double inputs have no
 -- native implementation (Spark rounds them through BigDecimal built from Double.toString), so they
 -- route through the codegen dispatcher and must match Spark exactly.
@@ -41,10 +43,14 @@ SELECT d, round(d), round(d, 0), round(d, 2), round(d, -1) FROM test_round
 query expect_dispatch(round)
 SELECT f, round(f), round(f, 0), round(f, 2), round(f, -1) FROM test_round
 
--- Null scale makes the whole result null without evaluating the child.
-query
+-- Null scale short-circuits in the dispatcher for floating-point inputs.
+query expect_dispatch(round)
 SELECT round(d, NULL), round(f, NULL) FROM test_round
 
+-- Compatible inputs use the native serializer's null-scale branch.
+query expect_native(round)
+SELECT round(dec, NULL), round(i, NULL), round(l, NULL) FROM test_round
+
 -- Decimal and integral inputs stay on the native path.
 query expect_native(round)
 SELECT dec, round(dec), round(dec, 2), round(dec, -1) FROM test_round
diff --git a/spark/src/test/resources/sql-tests/expressions/math/round_dispatch_disabled.sql b/spark/src/test/resources/sql-tests/expressions/math/round_dispatch_disabled.sql
new file mode 100644
index 0000000000..db0a60e3c3
--- /dev/null
+++ b/spark/src/test/resources/sql-tests/expressions/math/round_dispatch_disabled.sql
@@ -0,0 +1,37 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--   http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied.  See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+-- Config: spark.comet.exec.scalaUDF.codegen.enabled=false
+
+-- Disabling the dispatcher keeps supported inputs native and sends floating-point inputs to Spark.
+statement
+CREATE TABLE test_round_disabled(d double, f float, dec decimal(10,4), i int, l bigint) USING parquet
+
+statement
+INSERT INTO test_round_disabled VALUES
+ (2.5, 2.5, 2.5, 25, 25),
+ (-2.5, -2.5, -2.5, -25, -25),
+ (NULL, NULL, NULL, NULL, NULL)
+
+query expect_native(round)
+SELECT round(dec, 2), round(i, -1), round(l, -1) FROM test_round_disabled
+
+query expect_fallback(round: spark.comet.exec.scalaUDF.codegen.enabled=false)
+SELECT round(d, 2) FROM test_round_disabled
+
+query expect_fallback(round: spark.comet.exec.scalaUDF.codegen.enabled=false)
+SELECT round(f, 2) FROM test_round_disabled


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org