Repository navigation
[3/7] Add native batch capture and routing boundary - #1623
Conversation
|
JDBC integration tests triggered ( |
|
Integration test approval reset. New commits were pushed to this PR. Label(s) A maintainer must re-review and re-add a label to preview tests again. (The real gate runs in the merge queue.) Latest commit: 7d19fed |
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>
7d19fed to
597237e
Compare
shiminlin-db
left a comment
There was a problem hiding this comment.
Thanks a lot for adding this! Excited to see native batch insertion coming along!
|
|
||
| @Test | ||
| void unsupportedNativeExecutorFallsBackToLegacyExecution() throws Exception { | ||
| setBatchedInsertsEnabled(false); |
There was a problem hiding this comment.
Shall we set this to true in order to validate that the fallback comes from unsupportedNativeExecutor?
There was a problem hiding this comment.
Updated the test to enable batched inserts and use a two-row batch. It now verifies that native support is checked, native execution is not called, and the legacy multi-row rewrite is executed. The focused test suite passes.
| private boolean canUseNativeBatching(List<BatchParameterSet> batchParameterSets) { | ||
| return !batchParameterSets.isEmpty() | ||
| && connection.getConnectionContext().isNativeBatchingEnabled() | ||
| && InsertStatementParser.isParametrizedInsert(sql) |
There was a problem hiding this comment.
Can we also consider the multi-row VALUES case?
DBR will reject it. I'd expect it to be very rare (if at all) for customers to run multi-row VALUES with addBatch(), but if they do, native batch inserts will be a regression :(
Do we have telemetry on whether any customers do that? Or, if we detect it and convert it into a single-row VALUES, that'll give us a safe rollout. (Okay to do this in a separate PR though)
There was a problem hiding this comment.
We do not currently have telemetry for this SQL shape. We can address the multi-row VALUES case in a separate PR before enabling native batching by default.
There was a problem hiding this comment.
I see.
We can address the multi-row VALUES case in a separate PR before enabling native batching by default
Sounds good.
Signed-off-by: Sreekanth Vadigi <sreekanth.vadigi@databricks.com>
There was a problem hiding this comment.
Verdict: 1 Low
Looks good, with one low-severity concern. Snapshotting in addBatch(), the switch to one-based indexes and the native routing guard look correct, and production still always takes the legacy path. My only note is that the new native executor boundary doesn't handle unchecked exceptions.
There was a problem hiding this comment.
Verdict: 1 Low
Looks good, with one low concern. The refactor to snapshotted BatchParameterSet keeps legacy behavior: indexes stay one-based, and the legacy rewrite still uses containsKey(j) lookups. Routing stays inert in production because the native executor is the unsupported stub. The native path doesn't yet convert exceptions to the JDBC batch-failure type.
There was a problem hiding this comment.
Verdict: 2 Low
Looks good overall, with two low-severity concerns about the new native routing boundary. Capture and legacy-path refactoring keep existing behavior: setters already use 1-based cardinals, so keeping JDBC indexes matches what the legacy executor and both clients send today.
🥞 Stacked PR
Use this link to review incremental changes.
Description
Add the left-side capture and routing boundary for native prepared-statement batching.
addBatch()is called.NativeBatchExecutorcapability boundary.Production still supplies an unsupported native executor, so customer execution remains on the existing legacy path.
Testing
Additional Notes to the Reviewer
This PR does not add a Thrift/SEA native transport implementation, result extraction, fallback, telemetry, or customer-visible behavior changes.
NO_CHANGELOG=true