Skip to content

fix(kernel): report untyped NULL columns as STRING - #569

Open
vuanhphung wants to merge 3 commits into
mainfrom
fix/kernel-null-column-metadata
Open

vuanhphung wants to merge 3 commits into
mainfrom
fix/kernel-null-column-metadata

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Kernel results for SELECT NULL report NULL_TYPE through getSchema(), while Thrift and CAST(NULL AS STRING) report STRING_TYPE. Map retained NULL/VOID metadata and native Arrow Null fields to STRING, with regression coverage preserving null values.

Addresses DATATYPE-041 in #470. STATEMENT-023 remains open for a separate kernel fix.

Validated with 1,488 unit tests, build, lint, Prettier, and recorded-response replay using kernel 1.4.0 in default and async execution. TypeScript checking passes with @databricks/sql aliased to local sources; the default check encounters existing source/dist type duplication in a token-federation example.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 1 Low

The change looks correct, with one low concern: the metadata-driven NULL/VOID → STRING mapping is in place, but the Arrow-type fallback for native Null fields still reports NULL_TYPE. Value conversion isn't affected, since convertThriftValue treats NULL_TYPE and STRING_TYPE the same way, and the new tests cover both labels.

Comment thread lib/kernel/KernelArrowIpc.ts Resolved
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 1 Nit

Looks good. The NULL/VOID metadata mapping and the native Arrow Null mapping now both return STRING_TYPE, which matches Thrift. Nothing downstream relies on NULL_TYPE for value conversion: in convertThriftValue (lib/result/utils.ts), NULL_TYPE and STRING_TYPE both pass values through unchanged. The new parameterized tests cover all three paths and confirm the null values stay null.

Other findings

  • ⚪ Nit — In lib/kernel/KernelArrowIpc.ts, the line if (DataType.isNull(arrowType)) return TTypeId.STRING_TYPE; now returns the same value as the final return TTypeId.STRING_TYPE; fallthrough, so it no longer changes behavior. You could delete it, or keep it with a short comment so the Null→STRING mapping is stated explicitly. Either way, the result is the same.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
@vuanhphung

Copy link
Copy Markdown
Collaborator Author

Addressed the latest review nit in d9af9b9: removed the redundant Arrow Null branch so it uses the existing STRING fallback. All nine backend round-trip tests, including the three NULL metadata cases, pass.


This comment was generated with GitHub MCP.

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ No issues identified by the review bot.

This branch was successfully deployed

1 active deployment
azure-prod — d9af9b9f Deployed Nov 6, 2026 by vuanhphung via e2e-test (22.23.4, 22_23_4) #1789
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant