You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/12/05 11:44:39 UTC

[GitHub] [flink] hequn8128 commented on a change in pull request #10086: [FLINK-14584][python] Support complex data types in Python user-defined functions

hequn8128 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_r354147365
 
 

 ##########
 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:
   For multiset, we output a map? What's the behavior of java/scala?
   I think maybe we can support multiset in python later if we find there is a need. For python, there are no python types corresponding to multiset. Furthermore, a user can somehow use a map type to achieve multiset type. 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services