Repository navigation
Conversation
|
@fm4v, reapplied feature, you reverted (with feature flag setting to prevent backward-incompatible changes. |
|
Workflow [PR], commit [987e2e2] Summary: ❌
AI ReviewSummaryThe PR adds experimental exposure and enforcement of explicitly declared parameterized-view schemas, persisting the choice across reloads. Reviewed head: Declared-schema consumers traced: both parameterized-view builders validate substituted output; bare and parameterized Findings❌ Blockers
Tests
Final VerdictStatus: ❌ Block Preserve legacy parameterized-view behavior during metadata loading and add the upgrade regression. No duplicate inline comment or additional thread reply was posted for the acknowledged compatibility decision. |
007f335 to
d703e10
Compare
d703e10 to
47e813a
Compare
751ca2b to
c6c72b1
Compare
|
The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix. |
|
The MSan stress test failure (MemorySanitizer: use-of-uninitialized-value, STID 4179-5154 or 4148-3044) is a known pre-existing issue unrelated to this PR. Fix: #102158 |
|
Hi @GSokol, this PR has all reviewer feedback addressed and was approved by @GrigoryPervakov with all CI checks green at commit There is a small conflict in Could you please merge |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Reviewed by Cursor Bugbot for commit 8ce17c1. Configure here.
Show the schema of a parameterized view when it's explicitly specified.
The benchmark looked each row's group up in a constant array, `groups[number % 4096 + 1]`. About half of its CPU went to that lookup (`arrayElement` over a constant array copies row by row through a virtual `insertFrom`), not to the sampling-key code the test measures. On arm some builds run that loop about twice as slow in every server process: in the job profiles of the slow runs on ClickHouse#98708, ClickHouse#116376, ClickHouse#117754, ClickHouse#123545 and ClickHouse#123188 only that frame grew (x1.4 to x2.2) while every other frame stayed flat, so the query moved 20-27% and the confirmation restart reproduced it. The per-query tags collector numbers groups 0, 1, 2, ... with 0 reserved for the empty tag set (`ContextTimeSeriesTagsCollector.h`), so the 4096 groups the subquery creates are 1..4096 and the query can pass `number % length(groups) + 1` directly. `length(groups)` keeps the scalar subquery referenced: without it the analyzer drops the subquery, no group is registered and the function throws `Group 1 is out of bounds`. Checked on x86 with an official master build: the same keys over the 20M rows (`sum` and `groupBitXor` equal, 0 rows differ), 84 -> 52 ms, and the per-process medians of 24 processes span 79-91 ms before and 52-53 ms after. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ized_view_explicit_schema_v2
|
🕵 Merged current
|
The current version is now 26.11, so the settings history record of the new setting must be under it, as required by the `settings_changes_history` style check. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=98708&sha=4bf00b7b275ea3c8e1b697ebf6a11ea0bf56b315&name_0=PR&name_1=Style%20check ClickHouse#98708 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 Pushed One review thread is still open on purpose ( |
…match The `TYPE_MISMATCH` exception from `validateParameterizedViewSchema` reveals the declared column names and types, but it was thrown in `Context::buildParameterizedViewStorage` and `Context::executeTableFunction` before the planner checks access to the view. A user without any grant on the view could read its declared schema from the error. Now, right before a mismatch is reported, `SHOW COLUMNS` on the declared columns is checked for the caller; without it the query fails with `ACCESS_DENIED`, whose hint hides the column names. Matching views and column-level grants are unaffected. Address review: ClickHouse#98708 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
`applyMetadataChangesToCreateQuery` skipped the column list of every parameterized view, so a successful `ALTER TABLE pv COMMENT COLUMN` on a view with a declared schema updated only the in-memory metadata and was lost on `DETACH`/`ATTACH` or restart. Rewrite the column list for parameterized views whose stored definition declares one. Address review: ClickHouse#98708 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # src/Interpreters/InterpreterCreateQuery.cpp
…list With `use_declared_schema_for_parameterized_views` disabled, the declared column list of a parameterized view is dropped from its definition. In a `Replicated` database the normalized query is what gets enqueued, so the replicas replayed `ATTACH VIEW pv UUID '...' AS SELECT ...` without a column list, and the stub `ATTACH` detection rejected it with `BAD_ARGUMENTS`. This made `05037_parametrize_view_full_attach_schema` fail in DBReplicated runs. A parameterized view with a `SELECT` is a full definition even without a column list, so it is no longer treated as a stub `ATTACH`. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=98708&sha=c6cb30bc152e73231f9f8fe905a7ad4027ee6840&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%201%2F2%29 ClickHouse#98708 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…view_schema` `SELECT *` from `system.columns` broke after master added a new column to it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=98708&sha=c53e6ad66c0d71a7f4d94178f477ed63274cbc61&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29 and provide a fix in a separate PR. If the fix is already in progress, link it here.
The |
|
Acknowledged. I'm investigating the |
|
The fix is in #127765. The |
|
🕵 Merged the latest The previous red checks are not related to this PR:
The thread on |
# Conflicts: # src/Core/Settings.cpp
# Conflicts: # src/Interpreters/InterpreterCreateQuery.cpp
…arguments `master` now hides the arguments of table functions that are not registered (parameterized views included) in `EXPLAIN QUERY TREE`, failing closed in `SecretArgumentsRegistry`. The two `EXPLAIN QUERY TREE` outputs in the test now show `Literal '[HIDDEN]'` instead of `Literal UInt64_3`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=98708&sha=latest&name_0=PR PR: ClickHouse#98708 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 Merged the latest
The The thread on |
|
🕵 Merged the latest |
The current version is now 26.12, so the `settings_changes_history` style check requires the new setting to be recorded under it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 Merged the latest The private sync PR was conflicting with its The only remaining blocker is the review-threads gate: the open thread on |

Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Added the experimental setting
use_declared_schema_for_parameterized_views. When it is enabled, the column schema declared explicitly in a parameterized view is exposed inSHOW COLUMNS,system.columnsandDESCRIBE, and is validated against the actual schema after parameter substitution, throwingTYPE_MISMATCHif they differ. The decision is made when the view is created and stored with its definition, so it is the same on every replica and across restarts.Closes: #97288
Documentation entry for user-facing changes
Note
Medium Risk
Touches view/table-function execution and metadata exposure for parameterized views, including SQL security context handling and new runtime validation that can start throwing
TYPE_MISMATCHwhen enabled.Overview
Adds an experimental setting
use_declared_schema_for_parameterized_viewsto optionally expose and enforce explicitly declared column schemas on parameterized views.When enabled, parameterized view invocation now validates the post-substitution schema against the declared columns (throwing
TYPE_MISMATCHon mismatch) and allows declared columns to be used for view metadata/SHOW COLUMNS; this required wiring SQL SECURITY context into sample-block inference and passingContextPtrintoStorageViewconstruction. Tests were added for both matching and mismatching schemas, and GitHub hygiene is updated (PR template now asks for docs entry; Dependabot cargo configuration is removed).Reviewed by Cursor Bugbot for commit 3a2f11e. Bugbot is set up for automated code reviews on this repo. Configure here.
Workflow [PR]
Sync PR [sync-upstream/pr/98708]