Fix #758: Clear ARROW_FLAG_NULLABLE on the entries struct of MAP columns - #767
Open
adsharma wants to merge 1 commit into
Open
Fix #758: Clear ARROW_FLAG_NULLABLE on the entries struct of MAP columns#767adsharma wants to merge 1 commit into
adsharma wants to merge 1 commit into
Conversation
The Arrow columnar map layout requires both the entries struct of a map and the key child of that struct to be non-nullable. The existing converter only cleared the flag on the key child, so consumers such as arrow-java's MapVector rejected the schema with IllegalArgumentException: Map data should be a non-nullable struct type making every query that returns a MAP column unreadable through the Arrow API. Adding the flag clear on the entries struct brings the exported schema back in line with the spec.
adsharma
force-pushed
the
fix/issue-758-map-arrow-entries-nullable
branch
from
August 1, 2026 01:48
a897a28 to
d061eb6
Compare
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.
Fixes #758.
Problem
Any query returning a `MAP` column is unreadable through the Arrow result
API. Consumers (e.g. arrow-java's `MapVector`) reject the schema Ladybug
produces with:
```
IllegalArgumentException: Map data should be a non-nullable struct type
```
This also breaks `RETURN n.*` and `RETURN n`, since including a single
`MAP` column makes the whole Arrow read path unusable for that table.
Root cause
`ArrowConverter::setArrowFormat`, `LogicalTypeID::MAP` case
(`src/common/arrow/arrow_converter.cpp`), only cleared
`ARROW_FLAG_NULLABLE` on the key child of the entries struct. The Arrow
columnar map layout requires both the entries struct and the key child
to be non-nullable:
The fix is a single added line, applied immediately before the existing
key-child clear:
```cpp
child.children[0]->flags &=
~ARROW_FLAG_NULLABLE; // Map's entries struct must be non-nullable
```
Test
Added `ArrowTest.mapColumnArrowSchemaHasNonNullableEntriesAndKey` in
`test/api/arrow_test.cpp`. The test creates a `MAP(STRING, STRING)` column,
exports the Arrow schema through `getArrowSchema()`, and asserts:
Notes
upper-case `KEY`/`VALUE` naming mentioned in the issue is left for a
separate change.
end to end because the released `com.ladybugdb:lbug` artifact statically
links its own engine build, but the flag is what `arrow-java`'s exception
names, and it is now correct.