Repository navigation
Fix Arrow schema initialization without direct results - #565
vuanhphung wants to merge 1 commit into
Conversation
fc55d81 to
22fc232
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, with one low concern: the new live E2E tests aren't added to the nightly filter. Nit: the variadic schemaErrors ...error / detectEmbeddedSchema ...bool params quietly ignore any extra values; a plain or named parameter would be clearer.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
b5776eb to
bd9cd41
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 Medium · 2 Low
Looks good, with 1 low concern. I traced lazy schema initialization, the pending first page, the CloudFetch header replacement and the deferred-iterator error handling, and found no correctness defects. A nit: the new schemaErrors ...error and detectEmbeddedSchema ...bool variadics are used as optional parameters, which hides call-site intent.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
|
Regarding the optional-parameter nit: keeping the variadics preserves existing internal constructor call signatures; new callers pass named schemaErr/detectEmbeddedSchema state, and no caller supplies extra values. Public Rows interfaces remain unchanged. This comment was generated with GitHub MCP. |
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
Mostly solid: 1 medium concern. Multi-page Next() over inline batches that embed their own schema stops detecting those schemas after the first page. Nit: the CHANGELOG says IPC headers match the accessor schema's field metadata, but headers whose column names already match are passed through unchanged.
|
The changelog wording nit is fixed in dc69425: unchanged-name CloudFetch files preserve their original types and field metadata; only stale top-level names trigger a schema rewrite. This comment was generated with GitHub MCP. |
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: one low concern. Deferred schema initialization, the CloudFetch header splicing and the empty-page metadata paths are consistent and well tested. Pre-existing gap for follow-up: on main, a failed metadata RPC during a plain Next also loses the fetched page.
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: no blocking issues. I traced deferred initialization, retrying a pending page, header splicing and reader interfaces for cached CloudFetch files, metadata locking, and the EOF path for empty results, and found no regression. Nit: the test files arrow_review_test.go and arrow_final_review_test.go are named after the review rounds, not after what they test.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
|
The test-file naming nit is fixed in 1ba993c: the suites are now arrow_schema_fallback_test.go and arrow_schema_state_test.go, with unchanged test behavior. This comment was generated with GitHub MCP. |
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 found. I traced deferred initialization, CloudFetch header splicing, how cloudIPCReader keeps the reader interfaces, retrying pending pages, and Close behaviour against main. The IPC iterator's Close still leaves the page iterator open, which matches main. Scanning still uses fixed Timestamp_us, so the Etc/UTC change only affects the reported schema.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
1ba993c to
b9957f2
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 reasonable, with 1 low concern about cleanup after a failed lazy init. Follow-up, not caused by this PR: fetchResultPage still drops a page that was fetched by ordinary Next() when makeRowScanner fails; only the Arrow path keeps it as pendingArrowPage. Nit: the edited comment URLs in driver_e2e_test.go now point to .../databricks-sql-go/v2/issues/506, which is a broken link.
b9957f2 to
8d53ba5
Compare
|
The issue-506 URL nit is fixed in 8d53ba5: both comments again use #506. The scalar retry follow-up remains unchanged from main; pendingArrowPage was removed with the minimal-loader rewrite. This comment was generated with GitHub MCP. |
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, with 1 medium and 1 low concern. The lazy schema loader is a good fit, but it now runs during iteration as well, which can block CloudFetch results that main could decode, and one new metadata access is not nil-safe.
8d53ba5 to
a4a3a7d
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 Medium · 1 Low
Looks good apart from one medium concern: the lazy schema loader skips the record iterator's finished/closed guard. In the paths I traced, the CloudFetch override guard and the Nullable fallback behave correctly.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
a4a3a7d to
b2b800d
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 Medium · 2 Low
Looks good, with 1 low concern. The lazy first-page schema loading is sound and well tested on both accessors. The only issue is that the IPC iterator recovers from a failed schema conversion differently than the batch iterator does.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
b2b800d to
17f45a9
Compare
17f45a9 to
003e72a
Compare
|
Addressed maintainer Findings 2–4 in 1b321df (D37, amended into the original signed-off commit).
Lint, unit, root/rows race, kernel-tagged build/tests pass; 22 live Thrift schema cases and six kernel suites pass without skips. Extra metadata RPC: 55.7ms median (14 calls, shared warehouse). Alternating fresh-process benchmarks find no significant timing change; detailed numbers are in the updated description. Production/API-doc diff shrank from +106/-13 to +99/-13; independent D37 review found no introduced defects. |
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, with 1 low concern. Lazy metadata loading, the reused page-metadata cache and pending-error handling look correct, and both iterators have thorough unit coverage. One new E2E test is missing from the nightly filter.
003e72a to
1b321df
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, with 1 low concern. Lazy metadata loading, preserved pending errors and the nullable Thrift fallback look correct and are well covered by unit and E2E tests. The low concern is an edge case where the CloudFetch override schema can come from an inferred schema.
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
- 🔵 Low
internal/rows/arrowbased/arrowRecordIterator.go:233— IfSchema()builds its schema from Thrift metadata first (the metadata RPC had no ArrowSchema),ri.arrowSchemaByteskeeps that inferred schema. A later Clou
Judge's evidence:if len(fr.ResultSetMetadata.ArrowSchema) == 0 { schemaBytes = nil }
1b321df to
4afea30
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, with 1 low concern. The lazy metadata loader, pending-error preservation and Close-before-use handling look correct and are well covered. The only gap is a new nil dereference on later CloudFetch pages.
4afea30 to
dadf5f0
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, with one low concern. The lazy loader reuses cached metadata, keeps its state local and leaves #351's override in place. Nit: the loader captures r.resultSetMetadata when the iterator is created, so calling Columns() after GetArrowBatches can cost a second metadata RPC.
|
Re the review-body nit: Columns() after iterator construction can still make two metadata RPCs, as on 4afea30. D39 explicitly requires a construction-time snapshot so the loader never reads shared rows fields later. The ordinary status-only DirectResults and Columns-before-iterator cases now each make exactly one RPC in both accessors, covered by TestArrowSchemaBeforeFetching; no additional shared-state read is planned. This comment was generated with GitHub MCP. |
0c34f1e to
4fdac91
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, with 1 low concern. The lazy metadata loader, the pending-error preservation and the CloudFetch override handling look correct and are well tested. The nullable change in the shared Thrift→Arrow conversion also affects direct-results paths, and the PR doesn't say so.
4fdac91 to
7cafaa4
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 Nit
Looks good — no blocking issues. I traced both iterators: the loader leaves shared rows metadata untouched, only schemas the PR itself infers drop the #351 CloudFetch override, and pending fetch errors are kept. Two test nits only.
Other findings
- ⚪ Nit — The test loop calls
require.Empty(result.ResultFormat())in a tight loop with adefault:branch, so it busy-spins until the goroutine finishes. Add a short sleep or yield in the default branch, or check once afterfinished. (Found by Claude Opus 5.5 · confirmed by the judge) - ⚪ Nit — The inner
if count > 0is redundant insideif cloud && count > 0. The cloud=true/rows=0 subtests also run the same path as cloud=false. Drop the inner check and skip or rename the duplicate cases. (Found by Claude Opus 5.5 · confirmed by the judge)
|
Re the test nits: retaining the deadline-bounded ResultFormat loop to exercise concurrent metadata reads under -race; checking only after finished would weaken that regression. The redundant guard/empty CloudFetch variants are unchanged by D40 and test-only cleanup, so I’m leaving them rather than widening this inference-compatibility revert. This comment was generated with GitHub MCP. |
Load schemas lazily from cached metadata or GetResultSetMetadata in both Arrow iterators, with the unchanged Thrift fallback. Schema access does not fetch data or mutate shared rows metadata, and leaves pending page-fetch errors for Next. Reuse rows-held metadata and preserve the CloudFetch schema override unless this loader inferred the schema. Reject explicit non-Arrow formats and cover schema provenance and Next-before-Schema inline conversion. Fixes #312 Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
7cafaa4 to
16f9e44
Compare
Cold/empty Arrow results without direct metadata previously had no schema. Both existing iterators now use cached rows/page metadata or one lazy
GetResultSetMetadataRPC, preferring ArrowSchema and otherwise the unchanged Thrift conversion. Schema access does not fetch data, mutate shared rows metadata, or discard pending fetch errors. Explicit non-Arrow/non-URL result formats retain the existing driver error.#351 / ES-1804970 is unchanged from main: CloudFetch retains the constructor's
schemaBytesoverride, including its Thrift fallback, across pages. Only schemas newly inferred by this PR's loader/inline conversion omit the override. The pre-existing direct-CloudFetch timezone panic and raw IPC files' omission of Spark field metadata remain out of scope.Verified: lint (0 issues), 1,938 unit cases (11 ordinary credential-gated skips), root/rows race (rows shuffled), kernel-tagged build/tests, nine live Thrift cases and six kernel suites without skips. The format cases fail at 7cafaa4; disabling the inferred-schema guard panics in four real CloudFetch cases (
Etc/UTCvsUTC), and removing inline conversion fails all eight Next-before-Schema cases. D41 adds only 31 net test lines (+43/-12) and three production lines. Same three untouched generated Thrift gofmt exceptions as main. Extra metadata RPC: 65.0ms median (5 calls, 53.7–91.9ms) on the shared warehouse.Fresh-process benchmarks against main (alternating build order, n=6): inline no-direct fetch+schema 5.141→5.202µs (p=.310), direct 6.489→6.326µs (p=.732), cached
Columns()5.206→5.307µs (p=.240). No significant timing change; no-direct/cached paths add one 112-byte loader allocation, direct unchanged. Total test additions: 766 lines; total PR +883/-11 in the same 10 files. Harness/results stay outside the PR.Cross-driver state
DatabricksThriftAccessor.java:244,ArrowUtil.java:67,131@0ad7a49.thrift_backend.py:870,902@75a0d5d.ThriftOperationBackend.ts:321,ArrowResultHandler.ts:26@abedbbf.result_stream.rs:600,690@8d88cce; unchanged.Adversarial review: D39/D40 findings resolved; accepted D41 format/coverage findings fixed and mutation-tested. Bot APPROVED 16f9e44 with no findings; final-head required CI green and zero unresolved threads.
Fixes #312.
This pull request and its description were written by Isaac.