You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(backend/kernel): wire TSparkParameter through to kernel bind_param
Lifts the NotSupportedError that execute_command currently raises
for parametrized queries. The kernel-side PyO3 binding for
Statement.bind_param landed in databricks-sql-kernel#18; this
commit wires the connector's TSparkParameter shape through to it.
Implementation:
- New `bind_tspark_params(kernel_stmt, parameters)` in
type_mapping.py forwards each TSparkParameter to the kernel as
`(ordinal, value.stringValue, type)`. ordinal is the 1-based
position in the parameters list; the connector's `ordinal: bool`
flag is checked only to reject named bindings (kernel v0 doesn't
accept them on the wire).
- execute_command no longer raises on `parameters=[...]`. The
query_tags branch stays — that's a separate gap.
Tests:
- 6 new unit tests in tests/unit/test_kernel_type_mapping.py for
the mapper:
- positional forwarding preserves ordering and (ordinal, value, type)
- None value forwards as SQL NULL
- VOID passes through verbatim (kernel parser ignores value for VOID)
- named bindings raise NotSupportedError with a pointed message
- missing TSparkParameter.type defaults to STRING (defensive)
- empty parameters list is a no-op
- `test_execute_command_rejects_parameters` (which previously
asserted the NotSupportedError) replaced with
`test_execute_command_forwards_parameters_to_bind_param` — stubs
the kernel statement and verifies bind_param is called once per
TSparkParameter in order with 1-based ordinals, and execute
fires after binding.
- 3 new e2e tests in tests/e2e/test_kernel_backend.py against
dogfood:
- mixed-type round-trip (INT, STRING, BOOLEAN) via the
connector's native IntegerParameter/StringParameter/BooleanParameter
- None parameter (VoidParameter → SQL NULL)
- DECIMAL parameter with precision/scale carried in the SQL type
string (auto-inferred — explicit-arg path has a pre-existing
bug in native.py where format-args are swapped)
106/106 kernel unit tests pass.
Co-authored-by: Isaac
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
0 commit comments