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_r338859866
##########
File path:
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/utils/PythonUtil.scala
##########
@@ -19,50 +19,70 @@
package org.apache.flink.table.planner.plan.utils
import org.apache.calcite.rex.{RexCall, RexNode}
-import org.apache.flink.table.functions.FunctionLanguage
+import org.apache.flink.table.functions.python.PythonFunction
import org.apache.flink.table.planner.functions.utils.ScalarSqlFunction
import scala.collection.JavaConversions._
object PythonUtil {
+
+ /**
+ * Checks whether it contains Python function call in the specified node.
+ *
+ * @param node the RexNode to check
+ * @return true if it contains the Python function call in the specified
node.
+ */
+ def containsPythonCall(node: RexNode): Boolean = node.accept(new
FunctionFinder(true, true))
+
/**
- * Checks whether it contains the specified kind of function in the
specified node.
+ * Checks whether it contains non-Python function call in the specified
node.
*
* @param node the RexNode to check
- * @param language the expected kind of function to find
- * @param recursive whether check the inputs of the specified node
- * @return true if it contains the specified kind of function in the
specified node.
+ * @return true if it contains the non-Python function call in the
specified node.
*/
- def containsFunctionOf(
- node: RexNode,
- language: FunctionLanguage,
- recursive: Boolean = true): Boolean = {
- node.accept(new FunctionFinder(language, recursive))
+ def containsNonPythonCall(node: RexNode): Boolean = node.accept(new
FunctionFinder(false, true))
+
+ /**
+ * Checks whether the specified node is a Python function call.
+ *
+ * @param node the RexNode to check
+ * @return true if the specified node is a Python function call.
+ */
+ def isPythonCall(node: RexNode): Boolean = node.accept(new
FunctionFinder(true, false))
+
+ /**
+ * Checks whether the specified node is a non-Python function call.
+ *
+ * @param node the RexNode to check
+ * @return true if the specified node is a non-Python function call.
+ */
+ def isNonPythonCall(node: RexNode): Boolean = node.accept(new
FunctionFinder(false, false))
+
+ /**
+ * Checks whether the specified rexCall is python function call.
+ *
+ * @param rexCall the RexCall to check.
+ * @return true if it is python function call.
+ */
+ private def isPythonCall(rexCall: RexCall): Boolean = rexCall.getOperator
match {
Review comment:
Put this method into the class `FunctionFinder` and rename it to
`isPythonRexCall`? Because we have a `isPythonCall` already.
----------------------------------------------------------------
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