dianfu commented on a change in pull request #9748: 
[FLINK-14016][python][flink-table-planner] Introduce DataStreamPythonCalc for 
Python function execution
URL: https://github.com/apache/flink/pull/9748#discussion_r329827390
 
 

 ##########
 File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/FunctionDefinition.java
 ##########
 @@ -40,6 +40,13 @@
         */
        FunctionKind getKind();
 
+       /**
+        * Returns the language of function this definition describes.
+        */
+       default FunctionLanguage getLanguage() {
 
 Review comment:
   @twalthr Thanks a lot for your comments. Appreciated! Just share my thoughts 
as following:
   1. `Python ScalarFunction` also extends `ScalarFunction` and it will 
override `getLanguage`. If it's declared as final, there is no way to override 
it any more. This can be seen from the implementation of 
[PythonFunctionCodeGenerator](https://github.com/apache/flink/blob/fc4a1df1ad48224ae846fbbdeeb21b4b7b164e02/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/codegen/PythonFunctionCodeGenerator.scala#L74).
   2. Actually users could write a user-defined Python `ScalarFunction` with 
the `ScalarFunction` interface if they want(In this case, they need to override 
the getLanguage interface). 
[PythonFunctionCodeGenerator](https://github.com/apache/flink/blob/fc4a1df1ad48224ae846fbbdeeb21b4b7b164e02/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/codegen/PythonFunctionCodeGenerator.scala#L74)
 could be seen as an example how to do that, e.g. they need just implement the 
`PythonFunction` interface and wrap the serialized Python function inside it.
   
   Does it make sense to you? Looking forward to your feedback.
   

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