Fix NPE on materialising nested arrays or arrays of maps with NULL elements. - #1659
Open
michael-simons wants to merge 1 commit into
Open
Fix NPE on materialising nested arrays or arrays of maps with NULL elements.#1659michael-simons wants to merge 1 commit into
NULL elements.#1659michael-simons wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a NullPointerException when materializing complex arrays (nested arrays and arrays of maps) that include NULL elements, ensuring NULL is returned as a valid Java null array element when complex type support is enabled.
Changes:
- Add explicit handling for
nullelements during complex array element conversion inDatabricksArray. - Add new end-to-end integration tests covering nested arrays and arrays of maps containing
NULLelements.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/main/java/com/databricks/jdbc/api/impl/DatabricksArray.java |
Adds null handling in complex element conversion to avoid NPE when arrays contain NULL elements. |
src/test/java/com/databricks/jdbc/integration/e2e/ComplexTypeQueryTests.java |
Adds E2E tests validating NULL elements in nested arrays and arrays of maps. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…ith `NULL` elements. Null elements in strongly typed nested arrays are valid elements and must be returned as such. This fixes the instance of checking by adding a null-check on all nested branches (arrays of arrays, arrays of maps and arrays of structs). This closes databricks#1658. Signed-off-by: Michael Simons <michael@simons.ac>
michael-simons
force-pushed
the
issue/1658
branch
from
August 25, 2026 11:35
dbc0347 to
e903434
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.
Null elements in strongly typed nested arrays are valid elements and must be returned as such. This fixes the instance of checking by adding a null-check on both nested branches (arrays of arrays and arrays of maps).
No AI used.
This closes #1658.
Testing
End to end tested in
ComplexTypeQueryTests, three new test methods.Telemetry Errors
DatabricksDriverErrorCodewhere appropriate, and anynew code is uniquely numbered and tested.
requested because the author cannot access the classification.
Additional Notes to the Reviewer
Contributed as part of my work at Neo4j on our Databricks integration. No licence or usage restriction / source restriction on my contribution, also no AI used. Do whatever you want with the code.