gr4ve commented on a change in pull request #1405: [CALCITE-2772] Support 
varargs UDF for scalar function
URL: https://github.com/apache/calcite/pull/1405#discussion_r366126451
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/util/Smalls.java
 ##########
 @@ -368,8 +369,26 @@ public String toString() {
     }
   }
 
+
+  /** Example of a UDF with named parameters. */
+  public static class VarArgsFunction {
+
+    public static final AtomicInteger INSTANCE_COUNT = new AtomicInteger(0);
+
+    // Note: Not marked @Deterministic
+    public VarArgsFunction() {
+      INSTANCE_COUNT.incrementAndGet();
+    }
+
+    public int eval(@Parameter(name = "x")int x, @Parameter(name = "y") int... 
numerics) {
+      return IntStream.concat(IntStream.of(x), IntStream.of(numerics)).sum();
+    }
+  }
+
+
   /** Example of a UDF with a non-static {@code eval} method,
    * and named parameters. */
+
 
 Review comment:
   done

----------------------------------------------------------------
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

Reply via email to