You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by di...@apache.org on 2023/01/10 01:41:23 UTC

[flink] branch release-1.15 updated: [FLINK-28742][python] Fix ArrowUtils to support CHAR type

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

dianfu pushed a commit to branch release-1.15
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.15 by this push:
     new 310b8fb4206 [FLINK-28742][python] Fix ArrowUtils to support CHAR type
310b8fb4206 is described below

commit 310b8fb4206fe665e9c70149df37ffacf9e20b91
Author: Dian Fu <di...@apache.org>
AuthorDate: Mon Jan 9 19:41:05 2023 +0800

    [FLINK-28742][python] Fix ArrowUtils to support CHAR type
    
    This closes #21627.
---
 flink-python/pyflink/table/types.py                                 | 2 +-
 .../main/java/org/apache/flink/table/runtime/arrow/ArrowUtils.java  | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/flink-python/pyflink/table/types.py b/flink-python/pyflink/table/types.py
index 8217844b013..73cc1b6fd93 100644
--- a/flink-python/pyflink/table/types.py
+++ b/flink-python/pyflink/table/types.py
@@ -2397,7 +2397,7 @@ def to_arrow_type(data_type: DataType):
         return pa.float32()
     elif isinstance(data_type, DoubleType):
         return pa.float64()
-    elif isinstance(data_type, VarCharType):
+    elif isinstance(data_type, (CharType, VarCharType)):
         return pa.utf8()
     elif isinstance(data_type, VarBinaryType):
         return pa.binary()
diff --git a/flink-python/src/main/java/org/apache/flink/table/runtime/arrow/ArrowUtils.java b/flink-python/src/main/java/org/apache/flink/table/runtime/arrow/ArrowUtils.java
index 5e8b09fc425..28f0a74e51d 100644
--- a/flink-python/src/main/java/org/apache/flink/table/runtime/arrow/ArrowUtils.java
+++ b/flink-python/src/main/java/org/apache/flink/table/runtime/arrow/ArrowUtils.java
@@ -68,6 +68,7 @@ import org.apache.flink.table.types.DataType;
 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.DateType;
 import org.apache.flink.table.types.logical.DecimalType;
 import org.apache.flink.table.types.logical.DoubleType;
@@ -655,6 +656,11 @@ public final class ArrowUtils {
             return new ArrowType.FloatingPoint(FloatingPointPrecision.DOUBLE);
         }
 
+        @Override
+        public ArrowType visit(CharType varCharType) {
+            return ArrowType.Utf8.INSTANCE;
+        }
+
         @Override
         public ArrowType visit(VarCharType varCharType) {
             return ArrowType.Utf8.INSTANCE;