This is an automated email from the ASF dual-hosted git repository.
lgbo 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 50111a4411 [GLUIEN-9840][Flink] Support CHAR(N) (#9842)
50111a4411 is described below
commit 50111a44112b5e0f63d2167bb982a87c9afef0eb
Author: lgbo <[email protected]>
AuthorDate: Thu Jun 5 18:20:01 2025 +0800
[GLUIEN-9840][Flink] Support CHAR(N) (#9842)
---
.../src/main/java/org/apache/gluten/rexnode/RexNodeConverter.java | 3 +++
.../main/java/org/apache/gluten/util/LogicalTypeConverter.java | 3 +++
.../gluten/table/runtime/stream/custom/ScalarFunctionsTest.java | 3 +++
.../org/apache/gluten/table/runtime/stream/custom/ScanTest.java | 8 ++++++++
4 files changed, 17 insertions(+)
diff --git
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/RexNodeConverter.java
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/RexNodeConverter.java
index 7fa7d8f414..58c9dd6adb 100644
---
a/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/RexNodeConverter.java
+++
b/gluten-flink/planner/src/main/java/org/apache/gluten/rexnode/RexNodeConverter.java
@@ -101,6 +101,9 @@ public class RexNodeConverter {
return new DoubleValue(Double.valueOf(literal.getValue().toString()));
case VARCHAR:
return new VarCharValue(literal.getValue().toString());
+ case CHAR:
+ // For CHAR, we convert it to VARCHAR
+ return new VarCharValue(literal.getValueAs(String.class));
case BINARY:
return VarBinaryValue.create(
literal.getValue().toString().getBytes(StandardCharsets.UTF_8));
diff --git
a/gluten-flink/runtime/src/main/java/org/apache/gluten/util/LogicalTypeConverter.java
b/gluten-flink/runtime/src/main/java/org/apache/gluten/util/LogicalTypeConverter.java
index 30c3299990..b71f906e18 100644
---
a/gluten-flink/runtime/src/main/java/org/apache/gluten/util/LogicalTypeConverter.java
+++
b/gluten-flink/runtime/src/main/java/org/apache/gluten/util/LogicalTypeConverter.java
@@ -21,6 +21,7 @@ import io.github.zhztheplayer.velox4j.type.Type;
import org.apache.flink.table.types.logical.ArrayType;
import org.apache.flink.table.types.logical.BigIntType;
import org.apache.flink.table.types.logical.BooleanType;
+import org.apache.flink.table.types.logical.CharType;
import org.apache.flink.table.types.logical.DayTimeIntervalType;
import org.apache.flink.table.types.logical.DecimalType;
import org.apache.flink.table.types.logical.DoubleType;
@@ -58,6 +59,8 @@ public class LogicalTypeConverter {
Map.entry(
VarCharType.class,
logicalType -> new
io.github.zhztheplayer.velox4j.type.VarCharType()),
+ Map.entry(
+ CharType.class, logicalType -> new
io.github.zhztheplayer.velox4j.type.VarCharType()),
// TODO: may need precision
Map.entry(
TimestampType.class,
diff --git
a/gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/ScalarFunctionsTest.java
b/gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/ScalarFunctionsTest.java
index 0574fd55ce..8f0371d70e 100644
---
a/gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/ScalarFunctionsTest.java
+++
b/gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/ScalarFunctionsTest.java
@@ -103,6 +103,9 @@ class ScalarFunctionsTest extends GlutenStreamingTestBase {
String query4 = "select c < d as x from tblLess where a > 0";
runAndCheck(query4, Arrays.asList("+I[false]", "+I[false]", "+I[false]"));
+
+ String query5 = "select c > '123' from tblLess where a > 0";
+ runAndCheck(query5, Arrays.asList("+I[true]", "+I[true]", "+I[true]"));
}
@Test
diff --git
a/gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/ScanTest.java
b/gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/ScanTest.java
index 7b49e55fbf..d50a057959 100644
---
a/gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/ScanTest.java
+++
b/gluten-flink/ut/src/test/java/org/apache/gluten/table/runtime/stream/custom/ScanTest.java
@@ -169,4 +169,12 @@ class ScanTest extends GlutenStreamingTestBase {
runAndCheck(
query, Arrays.asList("+I[1, null]", "+I[2, {null=3, a=null, b=2}]",
"+I[3, {c=3, d=4}]"));
}
+
+ @Test
+ void testCharScan() {
+ List<Row> rows = Arrays.asList(Row.of(1, "a1"), Row.of(2, "b2"), Row.of(3,
"c2"));
+ createSimpleBoundedValuesTable("charTbl", "a int, b char(2)", rows);
+ String query = "select a, b from charTbl where a > 0";
+ runAndCheck(query, Arrays.asList("+I[1, a1]", "+I[2, b2]", "+I[3, c2]"));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]