Appender: support composite/nested lists and maps#399
Merged
staticlibs merged 1 commit intoduckdb:mainfrom Sep 25, 2025
Merged
Conversation
This PR adds support for appending to `MAP` and composite `LIST` columns, for example `LIST` of `STRUCT`s, `LIST` of `ARRAY`s or nested `LIST`s. It should cover virtually any table schema with composite fields, with the notable exception of `ARRAY`s with more than 2 dimensions (like `INT[2][3][4]`) - only 2D `ARRAY`s are supported. Higher dimensions could be possible, but the interface for them appeared to be tough to generalize. `LIST`s of `ARRAY`s can be used instead, like `INT[2][3][]`. `LIST`s can be specified as a `Collection` or `Iterator` (with `count`) of objects. `MAP`s are specified as `java.util.Map` instances. `STRUCT` inside a `LIST` can be specified either as `java.utils.LinkedHashMap` (keys are ignored) or as a `Collection` of values for `STRUCT` fields. `UNION` inside a `LIST` can be specified as an instance of `java.util.AbstractMap.SimpleEntry`, where a `key` is used as a tag to choose which `UNION` field to append to. If some required input cases are missed - please raise an issue. Testing: new tests added to cover various combinations of nesting.
10e00b3 to
401d201
Compare
staticlibs
added a commit
to staticlibs/duckdb-java
that referenced
this pull request
Oct 3, 2025
This is a backport of the PR duckdb#399 to `v1.4-andium` stable branch. This PR adds support for appending to `MAP` and composite `LIST` columns, for example `LIST` of `STRUCT`s, `LIST` of `ARRAY`s or nested `LIST`s. It should cover virtually any table schema with composite fields, with the notable exception of `ARRAY`s with more than 2 dimensions (like `INT[2][3][4]`) - only 2D `ARRAY`s are supported. Higher dimensions could be possible, but the interface for them appeared to be tough to generalize. `LIST`s of `ARRAY`s can be used instead, like `INT[2][3][]`. `LIST`s can be specified as a `Collection` or `Iterator` (with `count`) of objects. `MAP`s are specified as `java.util.Map` instances. `STRUCT` inside a `LIST` can be specified either as `java.utils.LinkedHashMap` (keys are ignored) or as a `Collection` of values for `STRUCT` fields. `UNION` inside a `LIST` can be specified as an instance of `java.util.AbstractMap.SimpleEntry`, where a `key` is used as a tag to choose which `UNION` field to append to. If some required input cases are missed - please raise an issue. Testing: new tests added to cover various combinations of nesting.
staticlibs
added a commit
that referenced
this pull request
Oct 3, 2025
This is a backport of the PR #399 to `v1.4-andium` stable branch. This PR adds support for appending to `MAP` and composite `LIST` columns, for example `LIST` of `STRUCT`s, `LIST` of `ARRAY`s or nested `LIST`s. It should cover virtually any table schema with composite fields, with the notable exception of `ARRAY`s with more than 2 dimensions (like `INT[2][3][4]`) - only 2D `ARRAY`s are supported. Higher dimensions could be possible, but the interface for them appeared to be tough to generalize. `LIST`s of `ARRAY`s can be used instead, like `INT[2][3][]`. `LIST`s can be specified as a `Collection` or `Iterator` (with `count`) of objects. `MAP`s are specified as `java.util.Map` instances. `STRUCT` inside a `LIST` can be specified either as `java.utils.LinkedHashMap` (keys are ignored) or as a `Collection` of values for `STRUCT` fields. `UNION` inside a `LIST` can be specified as an instance of `java.util.AbstractMap.SimpleEntry`, where a `key` is used as a tag to choose which `UNION` field to append to. If some required input cases are missed - please raise an issue. Testing: new tests added to cover various combinations of nesting.
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 PR adds support for appending to
MAPand compositeLISTcolumns, for exampleLISTofSTRUCTs,LISTofARRAYs or nestedLISTs.It should cover virtually any table schema with composite fields, with the notable exception of
ARRAYs with more than 2 dimensions (likeINT[2][3][4]) - only 2DARRAYs are supported. Higher dimensions could be possible, but the interface for them appeared to be tough to generalize.LISTs ofARRAYs can be used instead, likeINT[2][3][].Non-primitive
LISTs can be specified as aCollectionorIterator(withcount) of objects.MAPs can be specified asjava.util.Mapinstances.STRUCTinside aLISTcan be specified either asjava.utils.LinkedHashMap(keys are ignored) or as aCollectionofvalues for
STRUCTfields.UNIONinside aLISTcan be specified as an instance ofjava.util.AbstractMap.SimpleEntry, where akeyis used as a tag to choose whichUNIONfield to append to.If some required input cases are missing - please raise an issue.
Testing: new tests added to cover various combinations of nesting.
Fixes: #307, #344