HuangXingBo commented on a change in pull request #10086: [FLINK-14584][python] 
Support complex data types in Python user-defined functions
URL: https://github.com/apache/flink/pull/10086#discussion_r354752254
 
 

 ##########
 File path: flink-python/pyflink/table/tests/test_udf.py
 ##########
 @@ -375,20 +423,27 @@ def date_func(date_param):
                  DataTypes.FIELD("h", DataTypes.DOUBLE()),
                  DataTypes.FIELD("i", DataTypes.BYTES()),
                  DataTypes.FIELD("j", DataTypes.STRING()),
-                 DataTypes.FIELD("k", DataTypes.DATE())]))
+                 DataTypes.FIELD("k", DataTypes.DATE()),
+                 DataTypes.FIELD("l", DataTypes.ARRAY(DataTypes.BIGINT())),
+                 DataTypes.FIELD("m", DataTypes.MAP(DataTypes.BIGINT(), 
DataTypes.STRING())),
+                 DataTypes.FIELD("n", DataTypes.DECIMAL(38, 18))]))
 
         t.select("bigint_func(a), bigint_func_none(b),"
                  "tinyint_func(c), boolean_func(d),"
                  "smallint_func(e),int_func(f),"
                  "float_func(g),double_func(h),"
                  "bytes_func(i),str_func(j),"
-                 "date_func(k)") \
+                 "date_func(k),array_func(l),"
+                 "map_func(m),multiset_func(create_multiset_func()),"
+                 "decimal_func(n)") \
             .insert_into("Results")
         self.t_env.execute("test")
         actual = source_sink_utils.results()
         self.assert_equals(actual,
                            ["1,null,1,true,32767,-2147483648,1.23,1.98932,"
-                            "[102, 108, 105, 110, 107],pyflink,2014-09-13"])
+                            "[102, 108, 105, 110, 107],pyflink,2014-09-13,"
+                            "[1, 2, 3],{1=flink, 2=pyflink},{1=2, 2=1},"
 
 Review comment:
   Yes.Neither array, set, or map can represent the multiset very conveniently 
in Python.We can support support multiset in python later if we find a good 
structure to express multiset.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to