Github user KurtYoung commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3623#discussion_r108320480
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/TableFunction.scala
 ---
    @@ -86,12 +90,79 @@ abstract class TableFunction[T] extends 
UserDefinedFunction {
         * @return [[Expression]] in form of a [[TableFunctionCall]]
         */
       final def apply(params: Expression*)(implicit typeInfo: 
TypeInformation[T]): Expression = {
    -    val resultType = if (getResultType == null) {
    -      typeInfo
    +    buildTableFunctionCall(getClass.getSimpleName, typeInfo, params: _*)
    +  }
    +
    +  /**
    +    * Build a TableFunctionCall, a name and a sequence of params will 
determine a unique
    +    * [[TableFunctionCall]]
    +    *
    +    * @param name function name
    +    * @param implicitResultType If no result type returned, it will use 
this type.
    +    * @param params The input expressions
    +    * @return A unique [[TableFunctionCall]]
    +    */
    +  private[table] def buildTableFunctionCall(name: String,
    +                                            implicitResultType: 
TypeInformation[_],
    +                                            params: Expression*): 
TableFunctionCall = {
    +    val arguments = expressionsToArguments(params: _*)
    +    val resultType = getResultType(arguments, implicitResultType)
    +    TableFunctionCall(name, this, params, resultType)
    +  }
    +
    +  /**
    +    * Internal user of [[getResultType()]]
    +    *
    +    * @param arguments arguments of a function call (only literal arguments
    +    *                  are passed, nulls for non-literal ones)
    +    * @param implicitResultType The implicit result type
    +    * @return [[TypeInformation]] of result type or null if Flink should 
determine the type
    +    */
    +  private[table] def getResultType(arguments: java.util.List[AnyRef],
    --- End diff --
    
    The format of the parameters should be consistent with others


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to