WeiZhong94 commented on a change in pull request #9766: [FLINK-14018][python]
Add Python building blocks to make sure the basic functionality of Python
ScalarFunction could work
URL: https://github.com/apache/flink/pull/9766#discussion_r328465489
##########
File path: flink-python/pyflink/table/table_environment.py
##########
@@ -542,6 +542,24 @@ def register_java_function(self, name,
function_class_name):
.loadClass(function_class_name).newInstance()
self._j_tenv.registerFunction(name, java_function)
+ def register_function(self, name, function):
+ """
+ Registers a python user-defined function under a unique name. Replaces
already existing
+ user-defined function under this name.
+
+ Example:
+ ::
+
+ >>> table_env.register_function(
+ ... "add_one", udf(lambda i: i + 1, DataTypes.BIGINT(),
DataTypes.BIGINT()))
+
+ :param name: The name under which the function is registered.
+ :type name: str
+ :param function: The python user-defined function to register.
+ :type function: UserDefinedFunctionWrapper
+ """
+ self._j_tenv.registerFunction(name, function.judf)
Review comment:
Maybe we should rename the property to "_judf"?
----------------------------------------------------------------
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