Skip to content

Scalar functions post-integration changes#637

Merged
staticlibs merged 1 commit intoduckdb:mainfrom
staticlibs:scalar_functions_rename
Apr 9, 2026
Merged

Scalar functions post-integration changes#637
staticlibs merged 1 commit intoduckdb:mainfrom
staticlibs:scalar_functions_rename

Conversation

@staticlibs
Copy link
Copy Markdown
Collaborator

@staticlibs staticlibs commented Apr 9, 2026

This is a follow-up to PR #630.

It makes the following changes to newly added Scalar Functions Java API:

  • moves exception and registered shell classes into the DuckDBFunction.java
  • removes abstract classes for vector reader and writer
  • renames DuckDBScalarContext into DuckDBScalarFunctionCallData edit: removes completely
  • removes DuckDBScalarRow in favour of streaming plain indices of the input vector rows (as a LongStream); the row object inteface appeared to have an unintended overhead of creating a Java object for every input row that we would like to avoid.

Edit:

Null-propagation handling is changed the following way:

  • null propagation on Java side is enabled only for primitive callbacks (set automatically) and not exposed to the user, null propagation support for object callbacks is removed
  • null propagation on DuckDB engine side (duckdb_scalar_function_set_special_handling C API call skip) is also enabled automatically only for primitive callbacks, but it is additionally exposed to users as withNullInNullOut() builder call (replaces awkwardly named withSpecialHandling()); in some cases NULLs still can be passed to callbacks wheh withNullInNullOut() is set so callback still must check for nulls

Testing: more tests added aroung the null handling

@staticlibs staticlibs force-pushed the scalar_functions_rename branch 2 times, most recently from be93d43 to 2e7e1b9 Compare April 9, 2026 16:00
This is a follow-up to PR duckdb#630.

It makes the following changes to newly added Scalar Functions Java
API:

 - moves exception and registered shell classes into the
   `DuckDBFunction.java`
 - removes abstract classes for vector reader and writer
 - removes `DuckDBScalarContext` and `DuckDBScalarRow` in favour of
   streaming plain indices (as a `LongStream`) from the input data
   chunk; the row object inteface appeared to have an unintended
   overhead of creating a Java object for every input row that we would
   like to avoid. And without it the context abstraction appeared to be
   unnecessary

Null-propagation handling is changed the following way:

 - null propagation on Java side is enabled only for primitive callbacks
   (set automatically) and not exposed to the user, null propagation
   support for object callbacks is removed
 - null propagation on DuckDB engine side (
 `duckdb_scalar_function_set_special_handling` C API call skip) is also
 enabled automatically only for primitive callbacks, but it is
 additionally exposed to users as `withNullInNullOut()` builder call
 (replaces awkwardly named `withSpecialHandling()`); in some cases NULLs
 still can be passed to callbacks wheh `withNullInNullOut()` is
 set so callback still must check for nulls

Testing: more tests added aroung the null handling
@staticlibs staticlibs force-pushed the scalar_functions_rename branch from 2e7e1b9 to 6acf7ab Compare April 9, 2026 16:55
@staticlibs staticlibs merged commit ce0b489 into duckdb:main Apr 9, 2026
2 checks passed
@staticlibs staticlibs deleted the scalar_functions_rename branch April 9, 2026 16:56
staticlibs added a commit to staticlibs/duckdb-java that referenced this pull request Apr 10, 2026
This PR is a follow-up to duckdb#630 and duckdb#637.

It removes JNI utilities specific to scalar functions in favour of more
generic `GlobalRefHolder` utility.

Testing: no functional changes, no new tests
staticlibs added a commit that referenced this pull request Apr 11, 2026
This PR is a follow-up to #630 and #637.

It removes JNI utilities specific to scalar functions in favour of more
generic `GlobalRefHolder` utility.

Testing: no functional changes, no new tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant