This is an automated email from the ASF dual-hosted git repository.
dianfu pushed a commit to branch release-2.3
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-2.3 by this push:
new f01cf8cd6b7 [FLINK-40322][python] Fix Array/Multiset from_sql_type to
decode elements (#28912)
f01cf8cd6b7 is described below
commit f01cf8cd6b7dabb529760b97ab7fc121ebdc9301
Author: Nikolaus Schuetz <[email protected]>
AuthorDate: Wed Aug 5 00:07:27 2026 -0700
[FLINK-40322][python] Fix Array/Multiset from_sql_type to decode elements
(#28912)
---
flink-python/pyflink/table/tests/test_types.py | 12 ++++++++++++
flink-python/pyflink/table/types.py | 4 ++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/flink-python/pyflink/table/tests/test_types.py
b/flink-python/pyflink/table/tests/test_types.py
index 6a415e78114..24685e50af1 100644
--- a/flink-python/pyflink/table/tests/test_types.py
+++ b/flink-python/pyflink/table/tests/test_types.py
@@ -537,6 +537,18 @@ class TypesTests(PyFlinkTestCase):
dt = DataTypes.DATE()
self.assertEqual(dt.from_sql_type(0), datetime.date(1970, 1, 1))
+ def test_array_from_sql_type_converts_elements(self):
+ at = DataTypes.ARRAY(DataTypes.DATE())
+ self.assertEqual(
+ at.from_sql_type([0, 1]),
+ [datetime.date(1970, 1, 1), datetime.date(1970, 1, 2)])
+
+ def test_multiset_from_sql_type_converts_elements(self):
+ mst = DataTypes.MULTISET(DataTypes.DATE())
+ self.assertEqual(
+ mst.from_sql_type([0, 1]),
+ [datetime.date(1970, 1, 1), datetime.date(1970, 1, 2)])
+
@unittest.skipIf(on_windows(), "Windows x64 system only support the
datetime not larger "
"than time.ctime(32536799999), so this test
can't run "
"under Windows platform")
diff --git a/flink-python/pyflink/table/types.py
b/flink-python/pyflink/table/types.py
index 0182a3c3d69..b277ddc5162 100644
--- a/flink-python/pyflink/table/types.py
+++ b/flink-python/pyflink/table/types.py
@@ -923,7 +923,7 @@ class ArrayType(DataType):
def from_sql_type(self, obj):
if not self.need_conversion():
return obj
- return obj and [self.element_type.to_sql_type(v) for v in obj]
+ return obj and [self.element_type.from_sql_type(v) for v in obj]
class ListViewType(DataType):
@@ -1051,7 +1051,7 @@ class MultisetType(DataType):
def from_sql_type(self, obj):
if not self.need_conversion():
return obj
- return obj and [self.element_type.to_sql_type(v) for v in obj]
+ return obj and [self.element_type.from_sql_type(v) for v in obj]
class RowField(object):