Skip to content

fix(statement): send typed NULLs in native parameter sets as VOID - #516

Merged
aakash-saravanan-db merged 3 commits into
mainfrom
aakash-saravanan_data/fix/batch-null-void-20261130
Nov 30, 2026
Merged

aakash-saravanan-db merged 3 commits into
mainfrom
aakash-saravanan_data/fix/batch-null-void-20261130

Conversation

@aakash-saravanan-db

Copy link
Copy Markdown
Collaborator

Feature or gap

Native parameter sets sent TypedValue::Null as a STRING NULL, the same encoding ordinary statements use. The server combines a batch's sets into one inline table. A STRING NULL conflicts with the INT or BIGINT the other sets bind for that column, so the whole batch fails with INVALID_INLINE_TABLE.INCOMPATIBLE_TYPES_IN_INLINE_TABLE. The driver-test coverage for native batches (databricks/databricks-driver-test#2382) found this. ODBC is unaffected because its raw binder already sends VOID.

What this PR addresses

Inside a native parameter set, a typed NULL (TypedValue::Null, or kernel_statement_bind_null through the C ABI) is now sent as VOID, which takes the type the other sets bind. Ordinary statements and raw bindings are unchanged.

Tests and validation

cargo test passes, including 1,119 unit tests and 56 execution wire tests, along with formatting and warnings-denied Clippy on all targets. A new unit test covers positional and named NULLs in a set and checks that an ordinary statement still sends a STRING NULL.

Live, the driver-test kernel BATCH-009 case (a NOT NULL violation in one of three sets) fails with the type mismatch on main (run) and with the NOT NULL violation on this branch (run).

This pull request and its description were written by Isaac.

The server combines a native batch's parameter sets into one inline
table. A TypedValue::Null was sent as a STRING NULL, which conflicts
with the INT or BIGINT the other sets bind for that column, so the whole
batch failed with INVALID_INLINE_TABLE.INCOMPATIBLE_TYPES_IN_INLINE_TABLE.

Inside a parameter set, a typed NULL (TypedValue::Null or
kernel_statement_bind_null) is now sent as VOID, which takes the type
the other sets bind. Ordinary statements and raw bindings are unchanged.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>

@oss-reviewer-bot oss-reviewer-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.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

✅ No issues identified.

@vuanhphung vuanhphung left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

tests/v0_execute_e2e.rs:102):
This is the same shape as BATCH-009, which the description says failed on main with INCOMPATIBLE_TYPES_IN_INLINE_TABLE. So this test was passing before the fix because the batch failed at analysis, not because of the NOT NULL check, and it would stay green if NULLs went back to STRING. Could we assert the NOT NULL violation here (SQLSTATE 23502 or NOT_NULL in the message)? A positive case would also give the fix in-repo live coverage: a nullable BIGINT column with sets [1,10] [2,NULL] [3,30] succeeding with 3 modified rows.

The live native-batch test bound TypedValue::Null for a NOT NULL BIGINT
column and accepted any SQL error. On main the batch failed on the
inline-table type mismatch instead, so the test passed for the wrong
reason and would not catch a regression of the VOID encoding.

- The first batch now inserts [1,10] [2,NULL] [3,30] into a nullable
  BIGINT column and must report 3 modified rows.
- The failing batch must report the NOT NULL violation (SQLSTATE 23502,
  or NOT_NULL in the message).
- The final read checks every value, including the NULL.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>

@oss-reviewer-bot oss-reviewer-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.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Low

Looks good: 1 low concern. A NULL inside a native parameter set is now sent as VOID, and ordinary statements and raw bindings are unchanged. Unit and live e2e tests cover the fix.

Comment thread src/statement/mutable.rs Resolved
…r sets

The unit test checked only the in-memory parameters. This wire test
posts a batch with a typed NULL in a mixed column and in a column that
is NULL in every set, and matches the parameter_sets JSON.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
@aakash-saravanan-db

Copy link
Copy Markdown
Collaborator Author

@vuanhphung Done in e91cb63. The live test now inserts [1,10] [2,NULL] [3,30] into a nullable BIGINT column and expects 3 modified rows, and the failing batch must report the NOT NULL violation (SQLSTATE 23502, or NOT_NULL in the message). Both pass live: https://github.com/databricks/databricks-sql-kernel/actions/runs/46516476751. 7e02fd2 also adds a wire test for the VOID encoding.

@oss-reviewer-bot oss-reviewer-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.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

✅ No issues identified.

@aakash-saravanan-db
aakash-saravanan-db added this pull request to the merge queue Nov 30, 2026
@aakash-saravanan-db aakash-saravanan-db added the skip-coverage Skip the coverage fan-out for this PR (no tracking issue opened in databricks-driver-test) label Nov 30, 2026
Merged via the queue into main with commit 42efc25 Nov 30, 2026
41 of 44 checks passed

This branch was successfully deployed

1 active deployment
azure-prod — 7e02fd21 Deployed Nov 30, 2026 by oss-reviewer-bot[bot] via followup #4516
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-coverage Skip the coverage fan-out for this PR (no tracking issue opened in databricks-driver-test)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants