Skip to content

[4/7] Implement native Thrift parameter batching - #1625

Open
sreekanth-db wants to merge 6 commits into
mainfrom
sreekanth-db/stack/native-batch-thrift
Open

[4/7] Implement native Thrift parameter batching#1625
sreekanth-db wants to merge 6 commits into
mainfrom
sreekanth-db/stack/native-batch-thrift

Conversation

@sreekanth-db

@sreekanth-db sreekanth-db commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

🥞 Stacked PR

Use this link to review incremental changes.


Description

Add opt-in native PreparedStatement batch execution over Thrift.

  • Send ordered parameter sets through TExecuteStatementReq.batchParameters in one request.
  • Use negotiated protocol V10 for all-purpose clusters.
  • Attempt native batching for warehouses/serverless regardless of reported protocol.
  • Fall back to the existing legacy path on exact 42P02 [UNBOUND_SQL_PARAMETER] errors.
  • Return ordered JDBC update counts, including expansion of repeat-compressed backend rows.
  • Preserve atomic native failures as BatchUpdateException with backend SQLState, vendor code, and cause.

Native batching remains disabled by default through EnableNativeBatching=0.

Testing

  • Focused native Thrift, PreparedStatement, result-set, protocol, and routing tests passed.
  • Live serverless Thrift warehouse native insertion passed.
  • Live DBR 18.1 warehouse compatibility fallback passed.
  • Live DBR 19 all-purpose V10 native insertion passed.
  • Each live test verified JDBC update counts, inserted row count, and temporary-table cleanup.
  • Isaac review completed with zero final findings.

Additional Notes to the Reviewer

Real backend validation showed successful batch results may compress identical counts using the repeat column; the driver expands these rows back to one JDBC count per submitted parameter set.

NO_CHANGELOG=true

Keep existing batching behavior behind a dedicated executor so native routing can be added without changing the compatibility fallback.

Signed-off-by: Sreekanth Vadigi <sreekanth.vadigi@databricks.com>
Introduce a dormant opt-in and deterministic parameter snapshots so both native transports can share the same ordered payload without changing execution behavior.

Signed-off-by: Sreekanth Vadigi <sreekanth.vadigi@databricks.com>
Snapshot prepared parameter sets at addBatch time and route eligible batches through an injectable native executor while preserving the legacy production path.

Signed-off-by: Sreekanth Vadigi <sreekanth.vadigi@databricks.com>
Accept the immutable parameter map produced by the shared batch model instead of requiring a concrete HashMap.

Signed-off-by: Sreekanth Vadigi <sreekanth.vadigi@databricks.com>
Route eligible prepared batches through compute-aware Thrift batchParameters, preserve legacy compatibility fallback, and map repeat-compressed backend results to ordered JDBC update counts.

Signed-off-by: Sreekanth Vadigi <sreekanth.vadigi@databricks.com>
@github-actions

Copy link
Copy Markdown

JDBC integration tests triggered (replay, thrift + sea). View workflow runs.

@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

Looks good — clean, well-factored opt-in native Thrift batch path with solid unit coverage (routing, fallback, repeat expansion, ordinal mapping). Ordinal 0-based remap, unsetParameters/unsetResultRowLimit, the exact-42P02 legacy fallback, and 1-based column-index checks in getBatchUpdateCounts all check out. One low-severity note about EXECUTE_FAILED being reported when a successful batch returns an unexpected result shape.

Scope: reviewed as a stacked increment (7d19fed..head); the parent's changes are reviewed on the parent PR.

Surface post-success count-read errors as RESULT_SET_ERROR and clear committed batches before propagating so retries cannot duplicate inserted rows.

Signed-off-by: Sreekanth Vadigi <sreekanth.vadigi@databricks.com>
@github-actions

Copy link
Copy Markdown

Integration test approval reset.

New commits were pushed to this PR. Label(s) integration-test were removed for security.

A maintainer must re-review and re-add a label to preview tests again. (The real gate runs in the merge queue.)

Latest commit: 29c3268

@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

Solid, well-tested increment — native Thrift batch execution is opt-in, gated correctly, and the result-count extraction (with repeat-column expansion, maxRows bypass, and cardinality validation) is defensive and covered by unit tests. No correctness or resource-lifecycle bugs found. One low-severity robustness note on the fallback detection heuristic, plus a nit on the exception message.

Scope: reviewed as a stacked increment (7d19fed..head); the parent's changes are reviewed on the parent PR.

@sreekanth-db sreekanth-db changed the title Implement native Thrift parameter batching [4/7] Implement native Thrift parameter batching Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant