Scalar functions post-integration changes#637
Merged
staticlibs merged 1 commit intoduckdb:mainfrom Apr 9, 2026
Merged
Conversation
be93d43 to
2e7e1b9
Compare
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
2e7e1b9 to
6acf7ab
Compare
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow-up to PR #630.
It makes the following changes to newly added Scalar Functions Java API:
DuckDBFunction.javarenamesedit: removes completelyDuckDBScalarContextintoDuckDBScalarFunctionCallDataDuckDBScalarRowin favour of streaming plain indices of the input vector rows (as aLongStream); 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:
duckdb_scalar_function_set_special_handlingC API call skip) is also enabled automatically only for primitive callbacks, but it is additionally exposed to users aswithNullInNullOut()builder call (replaces awkwardly namedwithSpecialHandling()); in some cases NULLs still can be passed to callbacks whehwithNullInNullOut()is set so callback still must check for nullsTesting: more tests added aroung the null handling