hequn8128 commented on a change in pull request #11598: [FLINK-16914][python] 
Support ArrayType in vectorized Python UDF
URL: https://github.com/apache/flink/pull/11598#discussion_r402041197
 
 

 ##########
 File path: flink-python/pyflink/table/tests/test_pandas_udf.py
 ##########
 @@ -207,20 +213,38 @@ def timestamp_func(timestamp_param):
             udf(timestamp_func, [DataTypes.TIMESTAMP(3)], 
DataTypes.TIMESTAMP(3),
                 udf_type="pandas"))
 
+        self.t_env.register_function(
+            "array_str_func",
+            udf(array_func, [DataTypes.ARRAY(DataTypes.STRING())],
+                DataTypes.ARRAY(DataTypes.STRING()), udf_type="pandas"))
+
+        self.t_env.register_function(
+            "array_timestamp_func",
+            udf(array_func, [DataTypes.ARRAY(DataTypes.TIMESTAMP(3))],
+                DataTypes.ARRAY(DataTypes.TIMESTAMP(3)), udf_type="pandas"))
+
+        self.t_env.register_function(
+            "array_int_func",
+            udf(array_func, [DataTypes.ARRAY(DataTypes.INT())],
+                DataTypes.ARRAY(DataTypes.INT()), udf_type="pandas"))
+
         table_sink = source_sink_utils.TestAppendSink(
-            ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 
'n', 'o', 'p'],
+            ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 
'n', 'o', 'p', 'q',
+             'r', 's'],
             [DataTypes.TINYINT(), DataTypes.SMALLINT(), DataTypes.INT(), 
DataTypes.BIGINT(),
              DataTypes.BOOLEAN(), DataTypes.BOOLEAN(), DataTypes.FLOAT(), 
DataTypes.DOUBLE(),
              DataTypes.STRING(), DataTypes.STRING(), DataTypes.BYTES(), 
DataTypes.DECIMAL(38, 18),
-             DataTypes.DECIMAL(38, 18), DataTypes.DATE(), DataTypes.TIME(), 
DataTypes.TIMESTAMP(3)])
+             DataTypes.DECIMAL(38, 18), DataTypes.DATE(), DataTypes.TIME(), 
DataTypes.TIMESTAMP(3),
+             DataTypes.ARRAY(DataTypes.STRING()), 
DataTypes.ARRAY(DataTypes.TIMESTAMP(3)),
+             DataTypes.ARRAY(DataTypes.INT())])
         self.t_env.register_table_sink("Results", table_sink)
 
         t = self.t_env.from_elements(
             [(1, 32767, -2147483648, 1, True, False, 1.0, 1.0, 'hello', '中文',
               bytearray(b'flink'), decimal.Decimal('1000000000000000000.05'),
               
decimal.Decimal('1000000000000000000.05999999999999999899999999999'),
               datetime.date(2014, 9, 13), datetime.time(hour=1, minute=0, 
second=1),
-              timestamp_value)],
+              timestamp_value, ['hello', '中文', None], [timestamp_value], [1, 
2])],
 
 Review comment:
   Test nested array?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to