dianfu commented on a change in pull request #11470: [FLINK-16671][python] 
Support for defining scopes and variables on Python metric group
URL: https://github.com/apache/flink/pull/11470#discussion_r397641166
 
 

 ##########
 File path: flink-python/pyflink/metrics/tests/test_metric_it_case.py
 ##########
 @@ -0,0 +1,60 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+
+
+from pyflink.table import DataTypes
+from pyflink.table.udf import ScalarFunction, udf
+from pyflink.testing import source_sink_utils
+from pyflink.testing.test_case_utils import PyFlinkStreamTableTestCase
+import unittest
+
+
+class SubtractOne(ScalarFunction, unittest.TestCase):
+
+    def open(self, function_context):
+        mg = function_context.get_metric_group()
+        # test metric group info which is passed from Java to Python
+        self.assertTrue('.aaa' in mg.get_metric_identifier('aaa'))
+        self.assertTrue(len(mg.get_all_variables()) > 0)
+        self.assertTrue(len(mg.get_scope_components()) > 0)
+
+    def eval(self, i):
+        return i - 1
+
+
+class UserDefinedFunctionTests(object):
+
+    def test_chaining_scalar_function(self):
 
 Review comment:
   The method name doesn't reflect the purpose of the 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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to