dianfu 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_r333308079
 
 

 ##########
 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:
   Why test "add" in this test case?

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