Repository navigation
fix(statement): send typed NULLs in native parameter sets as VOID - #516
aakash-saravanan-db merged 3 commits into
Conversation
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>
vuanhphung
left a comment
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
🔀 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.
…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>
|
@vuanhphung Done in e91cb63. The live test now inserts |
Feature or gap
Native parameter sets sent
TypedValue::Nullas 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 withINVALID_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 sendsVOID.What this PR addresses
Inside a native parameter set, a typed NULL (
TypedValue::Null, orkernel_statement_bind_nullthrough the C ABI) is now sent asVOID, which takes the type the other sets bind. Ordinary statements and raw bindings are unchanged.Tests and validation
cargo testpasses, 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.