flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] hequn8128 commented on a change in pull request #9894: [FLINK-14342][table][python] Remove method FunctionDefinition#getLanguage.
Date Mon, 14 Oct 2019 12:39:21 GMT
hequn8128 commented on a change in pull request #9894: [FLINK-14342][table][python] Remove
method FunctionDefinition#getLanguage.
URL: https://github.com/apache/flink/pull/9894#discussion_r334450253
 
 

 ##########
 File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/utils/PythonUtil.scala
 ##########
 @@ -40,6 +42,15 @@ object PythonUtil {
     node.accept(new FunctionFinder(language, recursive))
   }
 
+  /**
+    * Checks whether the specified function is python function.
+    *
+    * @param function the function to check.
+    * @return true if it is python function.
+    */
+  def isPythonFunction(function: UserDefinedFunction): Boolean =
 
 Review comment:
   Change this to
   ```
     def isPythonCall(rexCall: RexCall): Boolean = rexCall.getOperator match {
       case sfc: ScalarSqlFunction => sfc.getScalarFunction.isInstanceOf[PythonFunction]
       case _ => false
     }
   ```
   so that we can simply the logic in `FunctionFinder` with:
   ```
     private class FunctionFinder(findPythonFunction: Boolean, recursive: Boolean)
       extends RexDefaultVisitor[Boolean] {
   
       override def visitCall(call: RexCall): Boolean = {
         findPythonFunction == isPythonCall(call) ||
           (recursive && call.getOperands.exists(_.accept(this)))
       }
   
       override def visitNode(rexNode: RexNode): Boolean = false
     }
   ```
   And also can simplify the visitCall method in `ScalarFunctionSplitter` with:
   ```
     override def visitCall(call: RexCall): RexNode = {
       visit(isPythonCall(call), call)
     }
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message