Repository navigation
Fix GLOBAL IN in projection WHERE with parallel replicas; restore coverage tests - #129863
alexey-milovidov merged 2 commits into
Conversation
|
Workflow [PR], commit [1cfc5bb] Summary: ✅
AI ReviewSummaryReviewed #129863 at Missing context / blind spots
Final VerdictStatus: ✅ Approve. No inline findings to post. |
With parallel replicas enabled, analysing the `WHERE` of a `PROJECTION` treated the source as remote, and `GlobalSubqueriesVisitor` replaced the right hand side of `GLOBAL IN` in the stored projection query in place with a temporary table `_data_...`. Every later `INSERT` then failed with `UNKNOWN_IDENTIFIER`. When the storage is created or attached, the projection is analysed with the global context, so `enable_parallel_replicas` in the default profile broke any such table regardless of session settings; `ALTER TABLE ... ADD PROJECTION` used the session settings. A projection is always calculated locally, so disable parallel replicas in the contexts of `getProjectionFromAST` and `calculateByQuery`. This is why the test `05515_global_subquery_projection_where` from #129425 failed in the `ParallelReplicas` jobs on master, which led to the revert in #129862. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=10e0db2ad742638c67d6321f6dcdae80cb4d5c2e&name_0=MasterCI Related: #129425 Related: #129862 Related: #129863 Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLOBAL IN in projection WHERE with parallel replicas; restore coverage tests
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 16 s compile time in total, 7 of them have a recent master baseline. |
|
But we should check if parallel replicas work with projections at all. Because they should. |
|
Checked: parallel replicas do work with projections. The fix here only disables them while a projection is built (its definition analysed, its data calculated on
Unrelated to parallel replicas: a projection whose |
#129863 reverts the revert #129862 (re-landing the tests-only #129425) and also carries a fix of its own, with a changelog entry. The nightly edit verifier treats every revert of a change of this release as cancelling out and required its bullet to be deleted (edit attempt 2/3 of https://github.com/ClickHouse/ClickHouse/actions/runs/44660948255), so the user-visible fix was lost. The 26.11 cycle is complete, so the nightly job will not edit this section again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hange A revert of a revert of this release was always treated as cancelling out, so its own bullet had to go. `ClickHouse#129863` re-landed the tests-only `ClickHouse#129425` (reverted by `ClickHouse#129862`) and also fixed `INSERT` into a table whose `PROJECTION` has `GLOBAL IN` in `WHERE`, with a `Bug Fix` entry of its own. The verifier rejected the edit that kept it ("Reverts of changes of this release still have entries of their own"), and the retried edit dropped the fix from the 26.11 changelog: https://github.com/ClickHouse/ClickHouse/actions/runs/44660948255 Such a re-apply, one that arrived under a strict-retention category, is no longer exempt from strict retention and not required to be deleted: its link stays, as a bullet of its own or merged into the entry it brought back. The prompt and the `edit-changelog` skill describe the case. Related: ClickHouse#126190 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The only conflict is in `ProjectionDescription::calculateByQuery`: master also has the `enable_parallel_replicas` line of #129863 and the positional arguments change of #126185 there, neither of which is on 26.10. Keep the 26.10 code and add only the `rewrite_in_to_join` line of #130143. Also take the three lines of #129006 that materialize constant columns of the calculated projection block. On 26.10 a projection column such as `exists(SELECT ...)` is calculated as a `ColumnConst`, and once #130143 gives it the right name, writing the projection part fails with `Bad cast from type DB::ColumnConst to DB::ColumnVector<char8_t>` (the `t_subquery_normal` case of 05569). The rest of #129006 is not needed on 26.10: its trigger, `optimize_constant_columns_after_filter`, does not exist there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reverts #129862 (restores the 7 coverage tests from #129425) and fixes the bug that made one of them fail.
05515_global_subquery_projection_wherefailed deterministically in theParallelReplicasstateless jobs on master (report) withUNKNOWN_IDENTIFIERon_data_...inINSERT. This was a real server bug, not a test problem: with parallel replicas enabled, analysing theWHEREof aPROJECTIONtreated the source as remote, andGlobalSubqueriesVisitorreplaced the right hand side ofGLOBAL INin the stored projection query in place with a temporary table that does not exist when the projection is calculated. When a table is created or attached, the stored projection is analysed with the global context, soenable_parallel_replicasin the default profile (as in that CI job) broke every such table regardless of session settings.ALTER TABLE ... ADD PROJECTIONtriggers it with only session settings.A projection is always calculated locally, so parallel replicas are now disabled in the contexts of
ProjectionDescription::getProjectionFromASTandcalculateByQuery. Added05565_projection_global_in_parallel_replicas, which reproduces the bug without the special CI config, and corrected the comments of05515, which described the rewrite as intended behaviour.Related: #129425
Related: #129862
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
INSERTfailing withUNKNOWN_IDENTIFIERinto a table whosePROJECTIONhasGLOBAL INinWHERE, when the projection was created (or the table was loaded) with parallel replicas enabled.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/129863]
Version info
26.11.1.1598-master(included in26.11and later)