[ 
https://issues.apache.org/jira/browse/FLINK-5795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15873401#comment-15873401
 ] 

ASF GitHub Bot commented on FLINK-5795:
---------------------------------------

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

    https://github.com/apache/flink/pull/3330#discussion_r101906986
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/CodeGenerator.scala
 ---
    @@ -1463,21 +1465,23 @@ class CodeGenerator(
         */
       def addReusableFunction(function: UserDefinedFunction): String = {
         val classQualifier = function.getClass.getCanonicalName
    -    val fieldTerm = s"function_${classQualifier.replace('.', '$')}"
    +    val functionSerializedData = serialize(function)
    +    val fieldTerm =
    +      s"""
    +         |function_${classQualifier.replace('.', 
'$')}_${DigestUtils.md5Hex(functionSerializedData)}
    --- End diff --
    
    Thanks @fhueske  
          Regarding the name collisions ,  the current implementation is to 
meet UDTF and UDF.
    But from `tableAPI` to `SqlFunction` the creation process has some work to 
do because the current UDF parameters do not take effect.I just make a simple 
test, did not carefully check the reasons (I would like to consider in the 
FLINK-5795). Feel free to let me know If you also want merge FLINK-5794 into 
this PR。:)
    
    Thanks, @wuchong 
    1. md5Hex used for carry the construction parameters of the situation, 
without md5Hex will produce object coverage, can not produce the correct 
results.
    2. `CodeGenUtils.newName` not work well, because this method use 
`AtomicInteger.getAndIncrement` generate name number, when we use multiple UDFs 
of the same state, it will lead to the creation of multiple UDF objects, and in 
fact a shared object is sufficient. e.g.
    `
        tEnv.registerFunction("func0", new Func13)
        tEnv.registerFunction("func1", new Func13)
        tEnv.registerFunction("func2", new Func13)
    `
    `reusableMemberStatements ` will contain three different elements, can not 
do the de-duplicates. and in fact a shared object is sufficient
    
    What do you think @fhueske @wuchong ?


> Improve “UDTF" to support constructor with parameter.
> -----------------------------------------------------
>
>                 Key: FLINK-5795
>                 URL: https://issues.apache.org/jira/browse/FLINK-5795
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API & SQL
>            Reporter: sunjincheng
>            Assignee: sunjincheng
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to