Skip to content

Fix NPE on materialising nested arrays or arrays of maps with NULL elements. - #1659

Open
michael-simons wants to merge 1 commit into
databricks:mainfrom
michael-simons:issue/1658
Open

Fix NPE on materialising nested arrays or arrays of maps with NULL elements.#1659
michael-simons wants to merge 1 commit into
databricks:mainfrom
michael-simons:issue/1658

Conversation

@michael-simons

@michael-simons michael-simons commented Aug 25, 2026

Copy link
Copy Markdown

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

  • Not applicable — this PR does not add or change a telemetry-visible error.
  • Applicable — the error uses DatabricksDriverErrorCode where appropriate, and any
    new code is uniquely numbered and tested.
  • Applicable — its driver/server/user classification is linked, or maintainer help is
    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.

Copilot AI lite review requested due to automatic review settings August 25, 2026 11:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 null elements during complex array element conversion in DatabricksArray.
  • Add new end-to-end integration tests covering nested arrays and arrays of maps containing NULL elements.

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.

Comment thread src/main/java/com/databricks/jdbc/api/impl/DatabricksArray.java
…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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

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.

[BUG] Nested arrays (ARRAY<ARRAY<INNER>>) cannot transport null values.

2 participants