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

    https://github.com/apache/flink/pull/3176#discussion_r100478286
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/UserDefinedFunction.scala
 ---
    @@ -24,4 +24,19 @@ package org.apache.flink.table.functions
       * User-defined functions must have a default constructor and must be 
instantiable during runtime.
       */
     trait UserDefinedFunction {
    --- End diff --
    
    The Scala wrapper class can be abstract class. 
    
    MathTrait.scala
    ```Scala
    trait MathTrait {
        def sum(x: Int, y: Int) = x + y
    }
    ```
    
    MathTraitWrapper.scala
    ```Scala
    abstract class MathTraitWrapper extends MathTrait {
    }
    ```
    
    JavaMath.java
    ```Java
    public class JavaMath extends MathTraitWrapper {
        public static void main(String[] args) {
                new JavaMath();
        }
    
        public JavaMath() {
                System.out.println(sum(2, 2));
        }
    }
    ```
    
    This code works as expected, printing the number 4 when it is run.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to