feat(sea): TypedValue codec converter for positional params#399
Open
msrathore-db wants to merge 1 commit into
Open
feat(sea): TypedValue codec converter for positional params#399msrathore-db wants to merge 1 commit into
msrathore-db wants to merge 1 commit into
Conversation
Add toNapiTypedValue() and convertOrdinalParametersToTypedValueInputs()
helpers that translate the Node driver's user-facing
{ ordinalParameters: [...] } shape into the flat
{ sqlType, value: string | null } payload the SEA napi codec
(databricks-sql-kernel/napi/src/params.rs) consumes.
The stringification rules (boolean -> "TRUE"/"FALSE", Date ->
toISOString(), BigInt/Int64 -> .toString(), integer Number -> "INTEGER",
non-integer Number -> "DOUBLE") are kept in lock-step with the Thrift
emitter's toSparkParameter, so a positional value bound on either
backend hits the server with the same wire-level (type-name, value)
pair. A regression-lock test pins this alignment branch-by-branch.
This is the JS-side half of the C5 (params-basic-binding) cluster.
The kernel-napi half lands in databricks-sql-kernel PR #84. SEA-side
wiring of these helpers into Connection.executeStatement(sql, options)
happens once the SEA backend abstraction (PR #378) lands on main.
Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DBSQLParameter.toNapiTypedValue()and a top-levelconvertOrdinalParametersToTypedValueInputs()helper that translate the Node driver's user-facing{ ordinalParameters: [...] }shape into the flat{ sqlType, value: string | null }payload the SEA napi codec consumes.toISOString(), BigInt/Int64 →.toString(), integer-Number →INTEGER, non-integer Number →DOUBLE) are kept in exact lock-step with the Thrift emitter'stoSparkParameter(). A regression-lock test pins the two emitters branch-by-branch, so a future refactor that diverges them breaks the test rather than silently breaking parity.C5 cluster context
This is PR-B of the C5 (params-basic-binding) chain:
TypedValuecodec.DBSQLParameterto napi'sTypedValueInput.BackendComparator.forEachBackendagainstdatabricks/databricks-driver-test.Each PR is independent and can be reviewed in parallel — they only depend on each other for the end-to-end live-warehouse run.
Why a converter on
main(and not full SEA wiring)The SEA backend abstraction lives in feature branches (PR #378).
maindoesn't yet have aSeaBackendimpl that would consume this codec, so this PR delivers the pure-TS load-bearing logic — the stringification path that bare JS values traverse on the way to the kernel. When the SEA backend abstraction lands onmain, the wiring is a one-liner that callsconvertOrdinalParametersToTypedValueInputs(options.ordinalParameters)and passes the result to the napi binding'sConnection.executeStatement(sql, { positional_params }).This shape lets the parity test land independently and lets each PR be reviewed for its own quality without one being blocked behind the others.
Quality gates
Test plan
This pull request and its description were written by Isaac.