You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a backport of the PR duckdb#644 to `v1.5-variegata` stable branch.
This PR is a continuation of duckdb#630, it adds support for writing DuckDB
table functions in Java.
Documentation is added to UDF.md.
Testing: new test added
Similar to scalar functions, a table function can be registered using `DuckDBFunctions.tableFunction()`.
212
+
213
+
Table function callback must implement `DuckDBTableFunction` interface:
214
+
215
+
-`bind` - called during `PREPARE` stage, must register output columns; has access to input parameters using `.getParameter()` and `.getNamedParameter()`; can return a "bind data" object
216
+
that can be used during function execution
217
+
-`init` - called once before the function execution, has access to bind data, returns an object used to track the state during function execution
218
+
-`localInit` (optional) - called once for every thread before the function execution, returns an object used to track thread-local state during function execution
219
+
-`apply` - has access to bind data, global init data and local init date, writes results into output vectors, returns a number of written row, is called by the engine repeatedly until it return zero rows
220
+
221
+
All callback arguments (including parameter objects) are only valid during the callback execution.
222
+
223
+
In general, Java table functions interface exposes the [C API table function interface](https://github.com/duckdb/duckdb-java/blob/2f4ed44df2fd1f89594cc7af28f9f8daba5fa582/src/duckdb/src/include/duckdb.h#L4145-L4478)
0 commit comments