Repository navigation
Fix Arrow Flight DoGet of a SQL ticket with an empty result - #125534
alexey-milovidov merged 5 commits into
Conversation
`DoGet` with a raw SQL query ticket collects the pulled blocks and passes them to `CHColumnToArrowColumn::chChunkToArrowTable`. For an empty result there are no blocks. `chChunkToArrowTable` accepts zero chunks (it builds the schema from the header), but `calculateArrowTable` constructed every `arrow::ChunkedArray` without a type, and Arrow cannot derive the type from an empty vector: `chunked_array.cc:54: Check failed: (chunks_.size()) > (0)`, returned to the client as `Code: 1001`. Pass the schema field type to the `ChunkedArray` constructor. It is the type every array of the column is already viewed as, so non-empty tables are unchanged, and an empty result now arrives as zero rows with the query's schema, as `GetFlightInfo` already returns it. Found by the protocol randomization in ClickHouse#125517. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review (2 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261012-233400 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261012-225700 |
|
Workflow [PR], commit [99c484f] Summary: ✅
AI ReviewSummaryReviewed #125534 at Final Verdict✅ Approve. |
Build profile diff (arm_release)Commit See the job log for details. |
`PullingPipelineExecutor::pull(Block &)` can return true with a cleared block, and `calculateArrowTable` indexes `getColumns()` of every chunk it receives. Skip such blocks before collecting chunks, as `executeSQLtoTables_impl` already does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@groeneai, fix conflicts. Also, about |
…et-empty-result Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Conflicts fixed by merging master (16b165e). Only the
|
CI finish ledger - 16b165eEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
These six rows are a re-run (07:49-09:24Z). The first run of the same six shards on this head passed (02:18-03:50Z), with the same Session id: cron:our-pr-ci-monitor:20261014-123006 |
|
🕵 Both CI failures on
I merged master to refresh the branch. The merge was clean. |
Resolve the conflict in ArrowFlightServer.cpp: 26.10 does not have #125534 (the `block.empty()` check in `DoGet`), so that check is left out and only #129193's lines are kept. Leave out 05497_arrowflight_exception_on_query_finish: 26.10 has no Arrow Flight port in the stateless test config (#125517 is master-only), so the test cannot connect there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the conflicts in ArrowFlightServer.cpp: 26.9 does not have #115250, #125534 and #125553, which changed the same lines (conversion settings, the `block.empty()` check in `DoGet`, `removeSpecialColumnRepresentations`), so their changes are left out and only #129193's lines are kept. Leave out 05497_arrowflight_exception_on_query_finish: 26.9 has no Arrow Flight port in the stateless test config (#125517 is master-only), so the test cannot connect there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the conflicts in ArrowFlightServer.cpp: 26.8 does not have #115250, #125534 and #125553, which changed the same lines (conversion settings, the `block.empty()` check in `DoGet`, `removeSpecialColumnRepresentations`), so their changes are left out and only #129193's lines are kept. Leave out 05497_arrowflight_exception_on_query_finish: 26.8 has no Arrow Flight port in the stateless test config (#125517 is master-only), so the test cannot connect there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #125517
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
DoGetover the Arrow Flight interface failing withCheck failed: (chunks_.size()) > (0)when a SQL query ticket returns no rows. It now returns an empty result with the query's schema.Description
On 26.8.21.12 and 26.3.33.24,
DoGetover Arrow Flight with the SQL ticketSELECT number FROM system.numbers LIMIT 0fails withCode: 1001 ... chunked_array.cc:54: Check failed: (chunks_.size()) > (static_cast<size_t>(0)) cannot construct ChunkedArray from empty vector and omitted typeinstead of returning an empty result. Any SQL ticket whose result has no rows hits it. Found by the protocol randomization in #125517 (comment).Root cause: for an empty result
DoGetpasses zero chunks toCHColumnToArrowColumn::chChunkToArrowTable, which supports that, butcalculateArrowTablebuilt eacharrow::ChunkedArraywithout a type, and Arrow cannot infer one from an empty vector.GetFlightInfoandPollFlightInfowere not affected (they handle an empty result before this call).Change: pass the schema field type to the
ChunkedArrayconstructor. Every array of the column is already a view of that type, so non-empty results are unchanged (identical IPC bytes before and after); an empty one now has the schemaGetFlightInforeports for it.DoGetalso skips zero-column blocks before collecting chunks, asexecuteSQLtoTables_impldoes.Validation: the new integration test fails on master with the error above and passes with the fix (20/20 repeats). All
test_arrowflight_interface,test_arrowflight_storageandtest_arrowflight_session_logtests pass, and the DeltaLake stateless tests (DeltaLake writes also go through this function) give the same results as without the fix.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/125534]
Version info
26.11.1.19-master(included in26.11and later)