Skip to content

Scalar functions post-integration changes (1.5)#649

Merged
staticlibs merged 1 commit intoduckdb:v1.5-variegatafrom
staticlibs:scalar_functions_rename_15
Apr 12, 2026
Merged

Scalar functions post-integration changes (1.5)#649
staticlibs merged 1 commit intoduckdb:v1.5-variegatafrom
staticlibs:scalar_functions_rename_15

Conversation

@staticlibs
Copy link
Copy Markdown
Collaborator

This is a backport of the PR #637 to v1.5-variegata stable branch.

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

This is a backport of the PR duckdb#637 to `v1.5-variegata` stable branch.

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 merged commit 88b2f8e into duckdb:v1.5-variegata Apr 12, 2026
@staticlibs staticlibs deleted the scalar_functions_rename_15 branch April 12, 2026 21:24
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