Repository navigation
feat: integrate APC metadata with rebased SEA execution - #1821
Conversation
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 Medium · 1 Low
Mostly solid: 1 medium concern. Async APC metadata submission, completion, redaction and catalog fan-out look consistent with the synchronous paths and are well tested. Only the polling cadence differs from the driver's configured async poll interval.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
Review incomplete
This review did not cover the whole change, so it is posted as a comment and does not approve the PR. Review the items below by hand, or split the PR so the bot can cover all of it:
- The PR diff exceeded the 200,000-byte review cap, so 13 test hunk(s) were not shown to the reviewer (tests:
src/test/java/com/databricks/jdbc/dbclient/impl/sqlexec/DatabricksSdkClientTest.java,src/test/java/com/databricks/jdbc/dbclient/impl/sqlexec/RedactingRequestTest.java,src/test/java/com/databricks/jdbc/dbclient/impl/thrift/DatabricksThriftServiceClientTest.java); no production code was dropped.
| try { | ||
| StatementState state = result.getStatementStatus().getState(); | ||
| if (state == StatementState.SUCCEEDED || state == StatementState.CLOSED) { | ||
| completed = true; |
There was a problem hiding this comment.
🔵 Low — awaitMetadata polls with a hardcoded Thread.sleep(50) and ignores the configured getAsyncExecPollInterval() that DatabricksSdkClient honours. This can send many GetStatement requests per second, especially in catalog fan-out. Read the interval from the connection context and use it for the sleep.
🔀 Found by Claude Opus 5.5 · confirmed by the judge
| if (emptyCatalogResult(request, session)) { | ||
| return immediateHandle(request, emptyKeyResult(request)); | ||
| } | ||
| catalog = |
There was a problem hiding this comment.
🟡 Medium — With multiple-catalog support disabled, async CROSS_REFERENCES auto-fills a null foreign catalog before resolveKeyBasedParams, so a null schema throws. Sync listCrossReferences passes the raw null catalog and resolves both catalog and schema from the session. Skip the autoFill for CROSS_REFERENCES and add a sync/async parity test.
🔀 Found by GPT-6.1 Sol · confirmed by the judge
5dc82b1 to
e561c71
Compare
4b9d5fb to
8061325
Compare
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 mostly sound, with 1 medium concern: the catalog fan-out ignores results that are already available. Redaction, header gating and the native-metadata format matrix look consistent, and the tests cover them well.
This overview is Claude Opus 5.5's initial take; some of its points were set aside by the cross-check judge and GPT-6.1 Sol added findings it doesn't mention — see the findings below.
🔀 1 finding considered and dismissed by the judge
- 🟡 Medium
src/main/java/com/databricks/jdbc/dbclient/impl/sqlexec/DatabricksMetadataQueryClient.java:521—fallbackAcrossCatalogssendscatalogsHandle(and each child handle) straight toconvertCompletedMetadata, and that method never checksgetImmediateResult<br>Judge's evidence:catalog = autoFillCatalog( catalog, isMultipleCatalogSupportDisabled() ? session.getCurrentCatalog() : null);`
Review incomplete
This review did not cover the whole change, so it is posted as a comment and does not approve the PR. Review the items below by hand, or split the PR so the bot can cover all of it:
- The PR diff exceeded the 200,000-byte review cap, so 14 test hunk(s) were not shown to the reviewer (tests:
src/test/java/com/databricks/jdbc/dbclient/impl/sqlexec/DatabricksSdkClientTest.java,src/test/java/com/databricks/jdbc/dbclient/impl/sqlexec/RedactingRequestTest.java,src/test/java/com/databricks/jdbc/dbclient/impl/thrift/DatabricksThriftServiceClientTest.java); no production code was dropped.
| throw unsupportedAsyncMetadata(); | ||
| } | ||
| try (DatabricksResultSet submitted = | ||
| queryExecutionClient.executeStatementAsync( |
There was a problem hiding this comment.
🔵 Low — A FAILED POST response with no statement_id makes executeStatementAsync throw from executeMetadataAsync. That skips the syntax-error fan-out and object-not-found empty-result handling that exists only in getMetadataExecutionResult. Apply the same error policy to submission failures, or document the difference, and add a test.
🔀 Found by GPT-6.1 Sol · confirmed by the judge
e561c71 to
468a6f6
Compare
8061325 to
c8996b1
Compare
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 High · 1 Medium
Needs changes: 1 high, 1 medium. Both are in the null-catalog fan-out. A child request that returns an immediate result crashes with an NPE, and fan-out started from a failed submission never closes or cancels its APC operations.
Review incomplete
This review did not cover the whole change, so it is posted as a comment and does not approve the PR. Review the items below by hand, or split the PR so the bot can cover all of it:
- The PR diff exceeded the 200,000-byte review cap, so 14 test hunk(s) were not shown to the reviewer (tests:
src/test/java/com/databricks/jdbc/dbclient/impl/sqlexec/DatabricksSdkClientTest.java,src/test/java/com/databricks/jdbc/dbclient/impl/sqlexec/RedactingRequestTest.java,src/test/java/com/databricks/jdbc/dbclient/impl/thrift/DatabricksThriftServiceClientTest.java); no production code was dropped.
| handle.addFallbackStatementId(catalogsHandle.getStatementId()); | ||
| DatabricksResultSet catalogs = convertCompletedMetadata(catalogsHandle, session, timeout); | ||
| List<List<Object>> rows = new ArrayList<>(); | ||
| try (ResultSet catalogRows = catalogs) { |
There was a problem hiding this comment.
🟠 High — In fan-out, a per-catalog executeMetadataAsync can return an immediate handle with a null statementId, for example an empty result after a not-found error. convertCompletedMetadata then polls a null ID and throws an uncaught NPE, which fails the whole call. Check child.getImmediateResult() first and use it directly. Don't record the null ID.
🔀 Found by both reviewers · confirmed by the judge
| TimeoutHandler timeout = | ||
| new TimeoutHandler( | ||
| queryExecutionClient.getConnectionContext().getMetadataOperationTimeout(), | ||
| "asynchronous metadata", |
There was a problem hiding this comment.
🟡 Medium — When submission fails with a parse error, fan-out runs on a throwaway failed handle and returns an immediate handle. The SHOW CATALOGS and per-catalog APC operations recorded on failed are never closed. The no-op timeout action also leaves the active child running after a timeout. Close failed.getFallbackStatementIds() in a finally block and cancel the active ID on timeout.
🔀 Found by both reviewers · confirmed by the judge
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 overall, with 1 low concern. I checked these and they hold up: the async handle and polling lifecycle, closing of operations on success and error paths, materialized metadata conversion before the source is closed, and the APC redaction paths.
Review incomplete
This review did not cover the whole change, so it is posted as a comment and does not approve the PR. Review the items below by hand, or split the PR so the bot can cover all of it:
- The PR diff exceeded the 200,000-byte review cap, so 15 test hunk(s) were not shown to the reviewer (tests:
src/test/java/com/databricks/jdbc/dbclient/impl/sqlexec/DatabricksSdkClientTest.java,src/test/java/com/databricks/jdbc/dbclient/impl/sqlexec/RedactingRequestTest.java,src/test/java/com/databricks/jdbc/dbclient/impl/thrift/DatabricksThriftServiceClientTest.java); no production code was dropped.
| new TimeoutHandler( | ||
| queryExecutionClient.getConnectionContext().getMetadataOperationTimeout(), | ||
| "asynchronous metadata", | ||
| () -> {}, |
There was a problem hiding this comment.
🔵 Low — In the submission-path parse-error fan-out, the TimeoutHandler's timeout action is a no-op and a fresh, unread AtomicReference is passed in. A timed-out child statement is therefore not cancelled; it is only closed in the finally block. Use the same cancel-on-timeout lambda over the AtomicReference passed to fallbackAcrossCatalogs, and add a test for this case.
🔀 Found by Claude Opus 5.5 · confirmed by the judge
82831dc to
3459ffb
Compare
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 · 1 Nit
Looks good, with 2 low concerns. Async SHOW metadata, catalog fan-out, cancel-on-timeout and APC diagnostic redaction are consistent with the synchronous paths and well covered by unit and HTTP-matrix tests. Nit: the per-catalog fan-out warning drops the cause and SQLState, and one test sleeps for 2.1s.
Other findings
- ⚪ Nit — The new async SCHEMAS conversion lowercases the catalog with the default-locale toLowerCase(). Under a Turkish locale,
Ibecomes a dotted character. Use toLowerCase(Locale.ROOT) here, and also in the synchronous listSchemas this copies. (Found by Claude Opus 5.5 · confirmed by the judge)
| } | ||
| throw e; | ||
| } finally { | ||
| closeMetadataOperation(handle.getStatementId()); |
There was a problem hiding this comment.
🔵 Low — getMetadataExecutionResult always closes the APC server operation in finally, but nothing marks the handle as consumed. A second call on the same handle polls a statement that is already closed and fails with an unclear server error. Either record consumption on the handle and throw INVALID_STATE on reuse, or document in the handle's Javadoc that it can be completed only once.
🔀 Found by Claude Opus 5.5 · the judge couldn't confirm it
3459ffb to
50bf766
Compare
50bf766 to
02276d6
Compare
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: 2 Low
Looks good: one low concern. Async metadata submission, polling, fan-out cleanup and diagnostic redaction look consistent with the synchronous paths, and the HTTP matrix tests cover them well.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
| timeout.checkTimeout(); | ||
| MetadataAsyncHandle child = executeMetadataAsync(request, session); | ||
| trackFallbackOperation(handle, child, activeId); | ||
| try (ResultSet converted = convertCompletedMetadata(child, session, timeout)) { |
There was a problem hiding this comment.
🔵 Low — Catalog fan-out only records each child operation ID and closes all of them in getMetadataExecutionResult's finally block, so server-side APC operations stay open for the whole scan and grow with catalog count. Close each child (and SHOW CATALOGS) as soon as it has been materialized.
🔀 Found by GPT-6.1 Sol · confirmed by the judge
| this, | ||
| timeoutErrorCode); | ||
| timeoutErrorCode, | ||
| redactApcDetails); |
There was a problem hiding this comment.
🔵 Low — A metadata timeout reports a different vendor code depending on the path. Async completion throws OPERATION_TIMEOUT_ERROR with its numeric code, both from cancelOnTimeoutHandler and from handleFailedExecution(..., true). The synchronous APC path builds its handler with TimeoutHandler.forStatement(..., redactApcDetails) and calls the 4-arg handleFailedExecution, so getErrorCode() is 0. If both paths should carry the code, pass includeVendorCode through for METADATA statements; otherwise add a test that pins the intended difference.
🔀 Found by Claude Opus 5.5 · the judge couldn't confirm it
02276d6 to
8314d6c
Compare
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, no blocking issues. Closing the source result set after conversion is safe because the builders read all rows up front, and parent-less metadata result sets never close the server operation. Nit: the fan-out timeout starts when the fallback begins, not at the original submission.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
Other findings
- 🔵 Low — The APC metadata support and procedure-parameter compatibility fallback change user-visible driver behavior but have no changelog entry, so the internal-only NO_CHANGELOG opt-out does not apply. Add a brief NEXT_CHANGELOG.md entry describing the APC metadata support. (Found by GPT-6.1 Sol · the judge couldn't confirm it)
… paths Async metadata completion polled with a hardcoded 50ms sleep, ignoring the async exec poll interval that statement execution honours. That multiplies server load during catalog fan-out, so read the interval from the connection context (keeping 50ms when none is configured). With multiple-catalog support disabled, async CROSS_REFERENCES auto-filled a null foreign catalog before resolving key params, so a null schema threw. The synchronous listCrossReferences passes the raw catalog and resolves both catalog and schema from the session. Skip the auto-fill for CROSS_REFERENCES and add sync/async parity coverage. Signed-off-by: Jay Xiao <jay.xiao@databricks.com>
A FAILED metadata POST without a statement_id skipped the parse-error catalog fan-out and object-not-found empty-result handling that getMetadataExecutionResult already applies. Signed-off-by: Jay Xiao <jay.xiao@databricks.com>
…d handles Fan-out children that resolve to an empty/not-found result carry no statement id; treat them as completed instead of polling null. Close SHOW CATALOGS and per-catalog operations when a submission parse error is fanned out inside executeMetadataAsync. Signed-off-by: Jay Xiao <jay.xiao@databricks.com>
…im redundant tests The submission-path parse-error fan-out in executeMetadataAsync used a no-op timeout action and a private AtomicReference, so a timed-out child statement was never cancelled. Share a cancel-on-timeout handler with the completion path. Drop tests duplicated by the HTTP matrix test (and the superseded HttpFake test) to keep the PR diff within review limits. Signed-off-by: Jay Xiao <jay.xiao@databricks.com>
…ROOT catalog lowercasing, richer fan-out warning, deterministic timeout test Signed-off-by: Jay Xiao <jay.xiao@databricks.com>
Drop CloseStatement/chunk log redaction duplicates and Arrow path diagnostic fixtures; keep package-owned SHOW/async fan-out coverage and the SdkClient cases that the routing PR rewrites to raw statement IDs. Signed-off-by: Jay Xiao <jay.xiao@databricks.com>
Signed-off-by: Jay Xiao <jay.xiao@databricks.com>
Routing owns log policy (raw server statement IDs). Wrapping metadata ResultSets with withRedactedDiagnostics was immediately reverted there. Signed-off-by: Jay Xiao <jay.xiao@databricks.com>
5d46f90 to
d954d04
Compare
Statement-id URL/body redaction and diagnostic wrapping were undone by routing. SQL/cluster redaction stays; routing owns session IDs. Signed-off-by: Jay Xiao <jay.xiao@databricks.com>
…-capabilities' into jay-xiao_data/jay-xiao/factory/apc-sea-v2/apc-metadata
Signed-off-by: Jay Xiao <jay.xiao@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 Medium
Looks good — no blocking issues found. Async SHOW metadata, catalog fan-out cleanup, APC-only close semantics and redaction paths check out against the eager MetadataResultSetBuilder conversions and DatabricksResultSet.close (parentless, no double close).
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
Other findings
- 🟡 Medium — APC SHOW metadata now uses a different wire format and gains working metadata execution, so this is user-visible behavior that does not qualify for the changelog opt-out. Add a brief NEXT_CHANGELOG.md entry describing APC metadata support and remove NO_CHANGELOG=true. (Found by GPT-6.1 Sol · the judge couldn't confirm it)
Description
Why: APC metadata calls need SHOW and procedure SELECT support, including async completion and the columnar response format. See #1809.
Change: Add typed metadata requests and handles, per-response decoding, async completion, and catalog fan-out for older-runtime syntax errors.
Testing
The metadata HTTP matrix, async completion, null-catalog fan-out, and warehouse fixtures are covered by unit and fake-service tests.
Post-review integration on 2026-11-19:
mvn -q spotless:checkandgit diff --check origin/mainpassed.mvn -q testran 4,487 JDBC core tests (zero failures or errors, 88 skipped), then stopped at the known pre-package thin test compilation dependency on shaded Arrow classes.mvn -q install -DskipTests -Ddependency-check.skip=truepassed. Installed thin and uber packaging suites each passed two tests, including live 100,000-row APC SEA queries against the RUNNING staging cluster; the earlier CreateSession HTTP 403/503 failures did not recur.Telemetry Errors
DatabricksDriverErrorCodewhere appropriate, and any new code is uniquely numbered and tested.Additional Notes to the Reviewer
Draft stack PR 5/7. Spec: #1809. Parent: #1820. Child: #1822.
NO_CHANGELOG=true