Results of 1 - 1 of about 1 for withReturnType (0.001 sec.)
- Write User Defined Functions 9414
- Overview The JDBC driver can register user-defined functions (UDFs) written in Java, including scalar functions and table functions. This page covers building and registering both, from the simple functional-interface overloads to the vecto
...ger.getConnection("jdbc:duckdb:")) { DuckDBFunctions.scalarFunction() .withName("java_add_one") .withParameter(int.class) .withReturnType(int.class) .withIntFunction(x -> x + 1) .register(conn); } SELECT java_add_one(41); The binary overloads take two argument...arameters() : DuckDBFunctions.scalarFunction() .withName("java_weighted_sum") .withParameters(double.class, double.class) .withReturnType(double.class) .withDoubleFunction((x, w) -> x * w + 10.0) .register(conn); SELECT java_weighted_sum(2.5, 4.0); Variadic Ar...hName("java_sum_varargs") .withParameter(Integer.class) // fixed argument .withVarArgs(intType) // variadic argument type .withReturnType(Integer.class) .withVarArgsFunction(args -> { int sum = 0; for (Object arg : args) { sum += (Integer) arg; } return sum; }... - https://man.mtool.work/duckdb/2.0/clients/java/functions.html
PREV
1
NEXT
DuckDB 2.0 Documentation / man.mtool.work