Repository navigation
Conversation
A pipeline port header describes the shape of a stream, not its contents, so it must have no rows. Nothing enforced that. Every dictionary source that published its factory sample block as its own header had to remember to write ISource(std::make_shared<const Block>(sample_block->cloneEmpty())), and DictionarySourceFactory::createSampleBlock deliberately seeds one row per column, where an attribute's row 0 holds that attribute's declared DEFAULT. Forgetting the strip stayed silent until some caller evaluated the header with input_rows_count = 0: StorageMerge wraps every child output in materialize, and checkFunctionArgumentSizes then reports a logical error. Normalize in ISource's constructor instead, which is the single point every source's port header passes through, so the strip cannot be forgotten. This also stops a DIRECT dictionary over an HTTP source from returning row 0 of its sample block as an extra data row. NativeORCBlockInputFormat is the one format that reads a value out of the block it was handed rather than out of its own columns: for a column the payload omits it does header_column.column->cloneResized(num_rows), which copies row 0, so an ORC dictionary source returns the attribute's declared DEFAULT instead of the type default. It now keeps the block as supplied, so that behaviour is unchanged. Closes: ClickHouse#116269
Both call sites already hold the block as a SharedHeader, so the wrapper collapses to passing it straight through. MySQLSource and SQLiteSource keep theirs on purpose: their parameter is a `const Block &`, so they have to build a shared_ptr in any case, and dropping `cloneEmpty()` there would copy the data instead of the shape without removing a line.
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold
Severity: ❌ blocker / Also checked and found clean, since they are the two ways this change could go wrong silently: Session id: cron:clickhouse-review-slot-9:20260827-041000 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20260827-020100 |
|
Workflow [PR], commit [aedbdd8] Summary: ❌
AI ReviewSummaryThe PR centralizes empty pipeline headers in Missing context / blind spots
Final VerdictStatus: ✅ Approve. No code changes requested; required CI should complete before merging. |
|
cc @novikd @Avogar, could you review this? |
Build profile diff (arm_release)Commit See the job log for details. |
CI finish ledger - c4d18f8Every failure below has an owner: a fixing PR, or a full-effort fix task whose fixing-PR link
Session id: cron:our-pr-ci-monitor:20260827-103000 |
|
Fixing PR for the two ledger rows above (the duplicate It gives the |
One conflict, in SourceFromSingleChunk's SharedHeader constructor. Master gave it an enable_auto_progress parameter and forwards it to ISource; this branch had dropped the manual cloneEmpty() from the same call. Kept both: the parameter and its forwarding stay, the block is passed straight through, and ISource strips the rows.
CI finish ledger - 76a03bcEvery failure below has an owner: a fixing PR (ours or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only
Not caused by this PR: that test drives an interactive client and waits on a fixed Session id: cron:our-pr-ci-monitor:20260829-180000 |
A PR that is opened and then reopened seconds later delivers two pull_request events at one head commit, so GitHub dispatches two complete PR workflow runs in parallel. Both are run_attempt = 1, and TEMPLATE_PULL_REQUEST_0 emits no concurrency block, unlike TEMPLATE_SCHEDULE and TEMPLATE_DISPATCH_WORKFLOW, so neither run supersedes the other. Everything the two runs share is keyed by (PR, sha) and never by RUN_ID: the S3 artifact objects from _Environment.get_s3_prefix_static, and the result_<workflow>.json document merged by _ResultS3.update_workflow_results. Two consequences measured at one commit of ClickHouse#116641 and of ClickHouse#116642: - Nine legs of one run died in the praktika pre-run artifact download with PreconditionFailed, because the other run re-uploaded the key while the ranged GET was in flight, so its ETag precondition no longer held. All nine are success in the sibling run at the identical tree, and two of them are flaky check legs. praktika had already closed this same race for the submodule cache object alone, with an If-None-Match write-once create in native_jobs.py. - The losing run's Finish Workflow read the shared result document while the other run's per-arch jobs were still RUNNING, and published "No per-arch Bugfix Validation job validated the bug". The sibling run contradicts it with three success jobs. Emit a concurrency group of workflow, PR number and head sha, with cancel-in-progress, for pull_request workflows. The head sha is in the group so a push starts a new group and never cancels the run at the previous commit. When the second run appears the first has created exactly one job, Config Workflow, so a supersession cancels that job and nothing else. The group is populated per event rather than written into the template, because TEMPLATE_PULL_REQUEST_0 is shared with the push workflows, where github.event.pull_request is null. A literal in the template would give MasterCI a degenerate group and, with cancel-in-progress, cancel every in-flight run on every master commit. master.yml and release_branches.yml stay byte-identical. The close-and-reopen originates from an app outside this repository. This change neither depends on it nor alters it, and a genuinely reopened PR still gets a run. retry_infra_failures.yml partially masks this today: a pre-run S3 failure is classified as infrastructure by its rule for a Run step that failed in under two minutes, and the run is retried. Co-Authored-By: Claude Opus 5 <[email protected]>
…ops the rows ClickHouse#116378 has merged, so master carries nine hand-written `std::make_shared<const Block>(...->cloneEmpty())` strips, plus a third YTsaurus one that a later PR copied (Cassandra, Redis, Null, DirectDictionary x2, MongoDB, ShellCommand, YTsaurus x3). Every one of them takes a `SharedHeader`, so with `ISource` normalizing the header they collapse to passing that header directly. The `createSampleBlock` comment no longer tells callers to strip the rows themselves. `05045_direct_dictionary_rowless_header` duplicated ClickHouse#116378's `05043_direct_dictionary_in_merge`; its two extra arms (a `DEFAULT` on the attribute and a plain `SELECT` from the dictionary) are folded into 05043 and 05045 is removed. With the strips gone, 05043 again fails if the `ISource` hunk is reverted.
Related: #116269
Related: #116378
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Description
A port header describes the shape of a stream, not its contents, so it carries no rows.
DictionarySourceFactory::createSampleBlockbuilds a dictionary source's sample block with one row per column, because row 0 of each attribute holds its declaredDEFAULTand several sources read it as a value. #116378 fixed #116269 by writingISource(std::make_shared<const Block>(sample_block->cloneEmpty()))by hand at nine sites, and forgetting it at a new one is silent untilStorageMergewraps the source inmaterializeand gets... to have 0 rows, but it has 1.ISource's constructor now drops the rows once, which covers every source's port header, including thegetInputFormatroute. The nine strips from #116378, and a tenth copied since, become plainISource(sample_block), as do the older ones inSourceFromSingleChunkandPostgreSQLSource.NativeORCBlockInputFormatis the only format that reads a value out of the block it was handed: for a column the payload omits it copies row 0, so an ORC dictionary source returns the declaredDEFAULT. It now keeps the block as supplied, and05046_orc_dictionary_declared_defaultpins that.Nothing user-visible changes on master.
05043_direct_dictionary_in_mergegains aDEFAULTand a plainSELECTarm. Validated with four Build-ID-checked binaries: master and this PR pass both tests; reverting only theISourcehunk makes 05043 hit the #116269 logical error, and reverting only the ORC hunk makes 05046 return0instead of999.I left the
IOutputFormatand transform sites alone, since they legitimately pass a populated block, and the strips whose argument is aBlockrather than aSharedHeader(for exampleMySQLSource,SQLiteSource,ArrowFlightSource), wheremake_sharedis needed anyway.Workflow [PR]
Sync PR [sync-upstream/pr/116641]