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/10/10 06:53:02 UTC
[GitHub] [flink] WeiZhong94 commented on a change in pull request #9865:
[FLINK-14212][python] Support no-argument Python UDFs.
WeiZhong94 commented on a change in pull request #9865: [FLINK-14212][python] Support no-argument Python UDFs.
URL: https://github.com/apache/flink/pull/9865#discussion_r333354648
##########
File path: flink-python/pyflink/table/tests/test_udf.py
##########
@@ -204,6 +204,26 @@ def eval(self, col):
self.t_env.register_function(
"non-callable-udf", udf(Plus(), DataTypes.BIGINT(), DataTypes.BIGINT()))
+ def test_no_argument_deterministic_udf(self):
+ @udf(input_types=[], result_type=DataTypes.BIGINT())
+ def one():
+ return 1
+
+ self.t_env.register_function(
+ "one", one)
+ self.t_env.register_function("add", add)
+
+ table_sink = source_sink_utils.TestAppendSink(['a', 'b'],
+ [DataTypes.BIGINT(), DataTypes.BIGINT()])
+ self.t_env.register_table_sink("Results", table_sink)
+
+ t = self.t_env.from_elements([(1, 2), (2, 5), (3, 1)], ['a', 'b'])
+ t.select("one(), add(a, b)") \
Review comment:
My initial thought was to use the "add" function to test whether the no-argument UDF can work with normal UDFs. It seems such worries are redundant so I have remove it in the latest commit.
----------------------------------------------------------------
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