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

philo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 3389570c2a [GLUTEN-10628][FLINK] Add decimal type support to 
`greaterthan` function (#10769)
3389570c2a is described below

commit 3389570c2ad46e1135c180ddecd45de8262f9121
Author: shuai.xu <[email protected]>
AuthorDate: Fri Sep 26 17:18:48 2025 +0800

    [GLUTEN-10628][FLINK] Add decimal type support to `greaterthan` function 
(#10769)
---
 .../functions/DecimalRexCallConverters.java        |  4 +++
 .../rexnode/functions/RexCallConverterFactory.java |  6 +++--
 gluten-flink/ut/src/test/resources/nexmark/q14.sql | 29 ++++++++++++++++++++++
 3 files changed, 37 insertions(+), 2 deletions(-)

diff --git 
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/DecimalRexCallConverters.java
 
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/DecimalRexCallConverters.java
index 2b36a4705a..7e41dc1342 100644
--- 
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/DecimalRexCallConverters.java
+++ 
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/DecimalRexCallConverters.java
@@ -24,6 +24,7 @@ import 
io.github.zhztheplayer.velox4j.expression.CallTypedExpr;
 import io.github.zhztheplayer.velox4j.expression.CastTypedExpr;
 import io.github.zhztheplayer.velox4j.expression.TypedExpr;
 import io.github.zhztheplayer.velox4j.type.BigIntType;
+import io.github.zhztheplayer.velox4j.type.BooleanType;
 import io.github.zhztheplayer.velox4j.type.DecimalType;
 import io.github.zhztheplayer.velox4j.type.DoubleType;
 import io.github.zhztheplayer.velox4j.type.IntegerType;
@@ -90,6 +91,9 @@ class DecimalArithmeticOperatorRexCallConverters extends 
BaseRexCallConverter {
       } else if (functionResultType instanceof DoubleType) {
         // The result is of type double when a decimal is operated with a 
double.
         return CastTypedExpr.create(new DoubleType(), expr, false);
+      } else if (functionResultType instanceof BooleanType) {
+        // For comparison, the result type is Boolean
+        return expr;
       }
       throw new FlinkRuntimeException(
           "Not supported type for decimal conversion: " + 
functionResultType.getClass().getName());
diff --git 
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/RexCallConverterFactory.java
 
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/RexCallConverterFactory.java
index 3d68f333dc..88f532544e 100644
--- 
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/RexCallConverterFactory.java
+++ 
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/functions/RexCallConverterFactory.java
@@ -43,13 +43,15 @@ public class RexCallConverterFactory {
               Arrays.asList(
                   () -> new 
BasicArithmeticOperatorRexCallConverter("greaterthan"),
                   () -> new StringCompareRexCallConverter("greaterthan"),
-                  () -> new 
StringNumberCompareRexCallConverter("greaterthan"))),
+                  () -> new StringNumberCompareRexCallConverter("greaterthan"),
+                  () -> new 
DecimalArithmeticOperatorRexCallConverters("greaterthan"))),
           Map.entry(
               "<",
               Arrays.asList(
                   () -> new 
BasicArithmeticOperatorRexCallConverter("lessthan"),
                   () -> new StringCompareRexCallConverter("lessthan"),
-                  () -> new StringNumberCompareRexCallConverter("lessthan"))),
+                  () -> new StringNumberCompareRexCallConverter("lessthan"),
+                  () -> new 
DecimalArithmeticOperatorRexCallConverters("lessthan"))),
           Map.entry(
               "=",
               Arrays.asList(
diff --git a/gluten-flink/ut/src/test/resources/nexmark/q14.sql 
b/gluten-flink/ut/src/test/resources/nexmark/q14.sql
new file mode 100755
index 0000000000..47fa7e92ec
--- /dev/null
+++ b/gluten-flink/ut/src/test/resources/nexmark/q14.sql
@@ -0,0 +1,29 @@
+CREATE FUNCTION count_char AS 'com.github.nexmark.flink.udf.CountChar';
+
+CREATE TABLE nexmark_q14 (
+    auction BIGINT,
+    bidder BIGINT,
+    price  DECIMAL(23, 3),
+    bidTimeType VARCHAR,
+    `dateTime` TIMESTAMP(3),
+    extra VARCHAR,
+    c_counts BIGINT
+) WITH (
+  'connector' = 'blackhole'
+);
+
+INSERT INTO nexmark_q14
+SELECT 
+    auction,
+    bidder,
+    0.908 * price as price,
+    CASE
+        WHEN HOUR(`dateTime`) >= 8 AND HOUR(`dateTime`) <= 18 THEN 'dayTime'
+        WHEN HOUR(`dateTime`) <= 6 OR HOUR(`dateTime`) >= 20 THEN 'nightTime'
+        ELSE 'otherTime'
+    END AS bidTimeType,
+    `dateTime`,
+    extra,
+    count_char(extra, 'c') AS c_counts
+FROM bid
+WHERE 0.908 * price > 1000000 AND 0.908 * price < 50000000;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to