hequn8128 commented on a change in pull request #9991: [FLINK-14478][python] 
optimize current python test cases to reduce test time.
URL: https://github.com/apache/flink/pull/9991#discussion_r338954219
 
 

 ##########
 File path: flink-python/pyflink/table/tests/test_udf.py
 ##########
 @@ -248,6 +248,25 @@ def test_open(self):
         actual = source_sink_utils.results()
         self.assert_equals(actual, ["1,1", "2,4", "3,3"])
 
+    def test_udf_without_arguments(self):
+        self.t_env.register_function("one", udf(
+            lambda: 1, input_types=[], result_type=DataTypes.BIGINT(), 
deterministic=True))
+        self.t_env.register_function("two", udf(
+            lambda: 2, input_types=[], result_type=DataTypes.BIGINT(), 
deterministic=False))
+
+        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(), two()").insert_into("Results")
+        self.t_env.execute("test")
+        actual = source_sink_utils.results()
+        self.assert_equals(actual, ["1,2", "1,2", "1,2"])
+
+
+class PyFlinkStreamUserDefinedFunctionTests(UserDefinedFunctionTests,
 
 Review comment:
   Maybe it's better to move these tests into 
`PyFlinkBlinkStreamUserDefinedFunctionTests`, the flink planner would be 
deprecated in the futhre.

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