Repository navigation
Remove the query analysis that preceded the analyzer - #120311
Conversation
#118629 froze `enable_analyzer` at `1` and left the old query analysis reachable through a handful of internal fallbacks. This removes those fallbacks, and with them the old analysis as a way a query can be analyzed. Nothing turns the analyzer off for a query anymore: - a secondary query from an initiator older than 23.3 no longer carries `allow_experimental_analyzer = 0` into this server, and a value that reaches a query some other way (a settings profile from the server configuration, `clickhouse-local` on the command line, an initiator that sends it) is normalized in `executeQuery`, so `getSetting` and `system.query_log` report the analysis that actually ran; - `EXPLAIN AST`, a view read by the old interpreter and a materialized view over a `Distributed` table no longer switch the setting off for the query they run; - `InterpreterFactory` builds `InterpreterSelectQueryAnalyzer` for every shape of a `SELECT`, `ASTSelectIntersectExceptQuery` included - that one used to reach the old interpreter regardless of the setting, which the old interpreter then noticed and reported as a possible bug. With that, every `if (enable_analyzer)` in `src` has one reachable arm, and the other arm is gone: 76 files, from the storages that chose between a query tree and an AST down to the constant-expression evaluator and the `isNull` family. Removing them makes a pile of code unreferenced - the parallel-replicas reading step built from an AST, `StorageDistributed::getOptimizedQueryProcessingStage`, `rewriteSelectQuery`, the `EXPLAIN` plan-secrets guard (the analyzer masks secrets in the plan, the old analysis could not) and `tryReuseStorageOrderingForWindowFunctions`, an optimization that had been obsolete for as long as it was analyzer-gated. Three consumers that were still analyzed the old way are converted to the analyzer instead: mutations, the `format_schema` query of `FormatSchemaInfo`, and the row lookup of `MaterializedPostgreSQL`. Mutations lose the `use_analyzer_for_mutations` server setting, the escape hatch from the rollout that made them analyzer-analyzed; it is the last thing that could have asked for the old analysis, and `parallel_replicas_only_with_analyzer` becomes obsolete for the same reason. Not removed: `InterpreterSelectQuery`, `ExpressionAnalyzer` and `TreeRewriter`. They are no longer how a query a user sends is analyzed, but they remain the machinery that compiles a standalone expression (a `TTL` expression, a sharding key, a column default) and a synthetic `SELECT` over a source built in place - the projection machinery and the AST-based arms of `EXPLAIN SYNTAX` and `EXPLAIN AST` do that and never go through query analysis. `InterpreterSelectQuery` says so now, so that no new caller is added. A pre-26.9 initiator therefore no longer gets the query analysis it asks its replicas for; `test_analyzer_compatibility`, whose initiator is a 24.2 server, covers that this server ignores the value instead.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
Workflow [PR], commit [e68d2f4] Summary: ✅
AI ReviewSummaryThis PR removes the remaining runtime fallbacks to the pre-analyzer query analysis, normalizes the obsolete analyzer setting across the main entrypoints, and keeps Findings
TestsNot run locally; review is from code inspection. Final VerdictChanges requested. LLVM Coverage ReportMeasured on commit e68d2f4.
Changed lines: Changed C/C++ lines covered: 842/874 (96.34%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes261 object files changed (-565.48 KiB total), 0 added.
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units1458 translation units recompiled, 9365 s compile time in total, 1458 of them have a recent master baseline. |
Removing `tryReuseStorageOrderingForWindowFunctions` from the list left the hard-coded `std::array<Optimization, 23>` one entry longer than its initializer, so the last element was value-initialized and its `is_enabled` was a null pointer-to-member. `optimizeTreeFirstPass` dereferences that before it reaches the `if (!optimization.apply)` guard meant to skip an uninitialized entry, for every query: a release build reads a byte of `QueryPlanOptimizationSettings` and carries on (no optimization is gained or lost), an ASan build reports a stack-buffer-overflow and an MSan build a use-of-uninitialized-value, which aborted the sanitizer servers on their first query. Deduce the size with `std::to_array` so the two cannot drift again. Co-Authored-By: Claude Opus 5 <[email protected]>
`MultiplexedConnections` and `HedgedConnections` forced
`allow_experimental_analyzer` into the set of changes sent with a query, so that
the initiator decides how the query is analyzed on every server that takes part
in it. Removing that made this server stop sending the setting at all - it is
never `changed` here anymore - so a replica older than 26.9 whose own profile
switches the analyzer off analyzed its part of the query the old way while the
initiator used the analyzer. `test_analyzer_compatibility` caught it, and the two
`set` calls are back, now simply sending `true`.
The reverse direction stays as it was: a pre-26.9 initiator that asks for the old
query analysis is ignored. The test pins what that costs. The two analyses do not
name the result columns the same way and an initiator matches a shard's block by
name, so a query selecting a function written in non-canonical case
(`hostname()`, which the analyzer resolves to `hostName()`) now fails on such an
initiator with `NOT_FOUND_COLUMN_IN_BLOCK`. A cluster still running the old query
analysis has to turn the analyzer on everywhere before upgrading any server to
26.9 - which is what the deprecation asked for. The known-incompatibility page
says so now.
The test also stops asking the shards for `getSetting('allow_experimental_analyzer')`
in that direction: an initiator this old folds the call to a constant before
sending the query, so every shard echoes the initiator's own value and the check
measured nothing. Its `system.query_log` entry on the new server is the
authoritative record and is what the test reads.
Co-Authored-By: Claude Opus 5 <[email protected]>
`test_generated_sql_always_runs_with_analyzer` read both `Settings['allow_experimental_analyzer']` and `Settings['enable_materialized_cte']` out of `system.query_log` for the query the PromQL handler generates. The handler used to turn the analyzer on explicitly, so the setting was in the changed set the row records; it does not have to anymore, and the row no longer carries it. The `AS MATERIALIZED` the generated SQL relies on still needs both, but only `enable_materialized_cte` is something the handler decides - the analyzer is the only query analysis there is. Check that one, and say so in the name. Co-Authored-By: Claude Opus 5 <[email protected]>
The query oracle picked `enable_analyzer` as a setting to compare a query under, and for it alone pinned the order - "always run the old first, so we can minimize the usage of it". Since the setting was frozen in 26.9 that arm only produces `SETTING_CONSTRAINT_VIOLATION`, and there is no second query analysis left to compare against, so the setting leaves the fuzzer's list along with the special case in the oracle. `parallel_replicas_only_with_analyzer` leaves it too: it is obsolete now, so the oracle would be comparing a query against itself. Co-Authored-By: Claude Opus 5 <[email protected]>
# Conflicts: # src/Interpreters/Context.cpp
Master moved to 26.10 while this branch was open. 26.9 is when `enable_analyzer` was frozen and the old query analysis stopped being selectable; 26.10 is when the code implementing it is gone and a server stops honouring the request of an initiator older than that. The setting's description, the known-incompatibility page, `InterpreterSelectQuery` and `test_analyzer_compatibility` each said 26.9 for both, so the half that is this release now says 26.10. Co-Authored-By: Claude Opus 5 <[email protected]>
…eadiness gate in its fixture test_start_offline failed on master 07f2c40 in Integration tests (amd_asan_ubsan, db disk, 3/8) with kazoo.handlers.threading.KazooTimeoutError on its very first statement. The failure CI reported, "Cannot delete /test_alive from node node1", is only a cascade out of the finally block. cluster.start() proves only that TCP port 9000 accepts a connection (wait_until_any_port_is_ready([9000])); it never probes 9181 and nothing in it looks at Keeper. The test body then opens a Keeper client without anything having established that a session can be created. In the failing run NuRaft ran five terms and four elections in three seconds. node1 logged "Quorum initialized" from a GotAppendEntryReqFromLeader callback and "[BECOME FOLLOWER] term 4" four milliseconds later: initialized_flag is a one-shot latch that is never cleared, so it means "this node has seen a leader once", not "a leader is serving now". cluster.start() declared node1 up 59 ms before node1 logged "Ready for connections". The client's in-flight SessionID request then failed, and KeeperTCPHandler answered sendHandshake(has_leader=false), which is deliberate: the comment at that site says the client will throw an exception and reconnect to another replica faster. The socket closed and kazoo raised KazooTimeoutError. keeper_utils.wait_nodes() was in this fixture and was removed on purpose by 6798b50 ("Wait on startup for Keeper"), which made the server start Keeper synchronously when it cannot reach a peer and assumed that subsumed the fixture gate. It does not: waitInit() returns on that same one-shot latch, and since that same commit it only logs a warning when it times out. wait_until_connected polls mntr until the node stops answering "This instance is not currently serving requests", then creates a real session and reads /keeper/api_version, retrying on KazooTimeoutError and ConnectionLoss, which is the only predicate that proves a session can be created end to end. Measured cost on a healthy cluster: 0.13 s per node. delete_with_retry and test_start_offline additionally stop the module from replacing its own real failure with a cleanup failure. A NoNodeError while deleting means the path is already absent, which is success for a cleanup helper, so the 30 attempts no longer burn out and raise "Cannot delete /test_alive from node node1" over the top of the original exception, and the finally blocks no longer dereference a client that was never bound. The 30-attempt path and its message stay identical for genuine failures. The same treatment covers the rest of the module. test_restart_third_node opens its client as the first statement inside its try, so its finally dereferenced an unbound name and reported UnboundLocalError instead of the KazooTimeoutError that actually failed the test; CI reported exactly that on ClickHouse#120311 in this same shard one day before the master run above. A single module-local stop_zk() helper now performs every client teardown, so all four sites share one exception-safe path, and test_start_offline's node2_zk, which nothing previously stopped, no longer survives into the two tests that follow it. Related: master SHA 07f2c40, Integration tests (amd_asan_ubsan, db disk, 3/8)
…the only one The architecture document said `InterpreterSelectQueryAnalyzer` has been the only query analysis since 26.9, which conflates two things this series does separately: 26.9 froze `enable_analyzer` at `1`, and 26.10 removes the analysis it used to switch to. Name all three dates instead. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The last assertion of `test_analyzer_compatibility` claims that a new-version initiator sends the analyzer setting under the canonical name the old version understands, and then reads the initiator's own `system.query_log`, which says `1` whatever the initiator sent - including nothing at all, or the `enable_analyzer` alias the old version has never heard of. Read the old instance's log for the same `initial_query_id`, which is the only place the name that arrived shows up. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
It explained keeping a change that disables the analyzer on the clamp paths by the internal code paths that still turned the analyzer off for a whole query on the initiator - `EXPLAIN AST`, a view read by the old interpreter. This series removes those, so say the reason that is left: the change is one this server did not author, and an initiator older than v26.9 still sends it. Nothing reads the value before it is normalized. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…context `allow_experimental_analyzer` is normalized in `executeQuery`, so that `getSetting` and `system.query_log` report the analysis that actually ran. The body of a `SQL SECURITY DEFINER` or `SQL SECURITY NONE` view does not start there: `getSQLSecurityOverriddenContext` builds a context from the global one and then applies the definer's profile, and a settings profile is applied without consulting the constraint that refuses a `0`. An access entity cannot be created carrying that value - `CREATE SETTINGS PROFILE ... SETTINGS enable_analyzer = 0` is refused - so the value can only come from a settings profile written in the server configuration, which is what the new integration test sets up. Where it did, the body of such a view reported an analysis that did not happen; the analyzer analyzed it either way. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Master removed the query analysis that preceded the analyzer (ClickHouse#120311), so `enable_analyzer` is an obsolete setting frozen at `1` and the `old analyzer` lane the `.sh` test's session-level pin worked around no longer exists. Both tests pass locally against the merged branch. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`PredicateExpressionsOptimizer` is the predicate push-down that `TreeRewriter` ran on the AST: it moved the non-aggregate conjuncts of `HAVING` into `WHERE`, and pushed `WHERE` and `PREWHERE` conjuncts into the subqueries of the join tree. ClickHouse#120311 removed the query analysis that preceded the analyzer, so no query is executed through it anymore: the analyzer pushes predicates as the `filterPushDown` query plan optimization, and rejects a non-aggregate `HAVING` conjunct instead of moving it (`analyzer_compatibility_allow_non_aggregate_in_having` asks for the old move). What was left of the AST rewrite was reachable only through the users of `InterpreterSelectQuery` that ClickHouse#120311 kept: the projection machinery (`ProjectionsDescription`, `optimizeUseAggregateProjection`), the synthetic `SELECT` that compiles a row policy expression, and the AST arm of `EXPLAIN SYNTAX` for a query that is not a `SELECT`. A projection query and a row policy expression have no `WHERE`, `HAVING` or subquery for the rewrite to act on, so the only visible difference is the AST that `EXPLAIN SYNTAX INSERT INTO ... SELECT` prints - a predicate is no longer shown copied into a subquery of the `SELECT`, and a non-aggregate `HAVING` conjunct is no longer shown moved to `WHERE`. `EXPLAIN SYNTAX` of a `SELECT` is unaffected: it is formatted from the query tree, which never carried this rewrite. `replaceJoinedTable` goes with it. It wrapped the right-hand table of a `JOIN` into `(SELECT * FROM table)` for the sole purpose of giving the push-down a subquery to push into, and was gated by the same setting. `enable_optimize_predicate_expression` becomes obsolete, because nothing reads it anymore. `PredicateRewriteVisitor` stays, and so do `enable_optimize_predicate_expression_to_final_subquery` and `allow_push_predicate_when_subquery_contains_with`: `ReadFromRemote` uses them to push a predicate into a distributed subquery on the AST level, under `allow_push_predicate_ast_for_distributed_subqueries`. That one is a live optimization of the analyzer pipeline rather than a leftover, so removing it is a separate change that needs an equivalent at the query tree or plan level first. Related: ClickHouse#93288 Related: ClickHouse#120311 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
master removed the query analysis that preceded the analyzer (ClickHouse#120311), deleting StorageDistributed::getOptimizedQueryProcessingStage outright. The AST half of this fix lived inside that function, so it goes with it, together with its helper selectHasOuterJoinPaddingMainTable and the Parsers/ASTTablesInSelectQuery.h include that existed only for it: an unused function in an anonymous namespace does not survive -Werror. master's own hasLimitAfter()/hasLimitUntil() addition to the surviving analyzer path is preserved. The analyzer-path guard, now the entire fix, is placed below the collectSets() call that 999d6ea added to isShardingKeySuitsQueryTreeNodeExpression rather than above it. Registering the expression's IN sets is precisely what that commit fixed, and ordering the guard after it leaves master's side effects on the reject path unchanged; the cost is one tree traversal on a path that then returns false. The regression test loses its five old-analyzer arms. executeQuery.cpp now raises INCORRECT_QUERY for any SETTINGS allow_experimental_analyzer = 0 found in the query AST, the setting being IMPORTANT | OBSOLETE and frozen at 1, so each of those arms errored and failed the test on current master. Every one was a byte-for-byte twin of the analyzer arm above it, so the coverage that proves the guard is untouched; the "(analyzer)" label suffixes, which no longer contrast with anything, are dropped with them.
… Distributed table
A `CREATE TABLE` whose `CHECK` constraint contains a scalar subquery over a
`Distributed` table or `remote(...)` kills the server:
CREATE TABLE t (x UInt64, CONSTRAINT c CHECK x < (SELECT max(id) + 1000
FROM remote('127.0.0.1', currentDatabase(), 'src'))) ENGINE = MergeTree ORDER BY tuple();
`InterpreterCreateQuery::getConstraintsDescription` analyses every constraint with
`TreeRewriter::analyze`, which runs `executeScalarSubqueries`; that visitor built
`InterpreterSelectWithUnionQuery` unconditionally, and the old interpreter never
assigns `query_info.query_tree` or `query_info.planner_context`. Since
`StorageDistributed::read` has no non-analyzer arm any more, it dereferences the
planner context unconditionally and the read faults on a null pointer.
A `TTL ... WHERE` predicate is a second carrier of the same fault, not a separate bug:
`TTLDescription::getTTLFromAST` analyses the `DELETE WHERE` predicate through the same
`TreeRewriter::analyze` (`TTLDescription.cpp:1490` then `:1270`), so the one fix resolves
both slots. The two differ in how the source may be named: the `remote(...)` table
function is rejected before planning there with `THERE_IS_NO_QUERY`, because a TTL
description is built without a query context and resolving a table *function* needs one,
so only a named `Distributed` table reaches the dereference. Both slots are covered by the
new test, the `TTL` one through a named table.
The branch that used to hide this was keyed on `allow_experimental_analyzer`, which has
been frozen at 1 since ClickHouse#118629, and ClickHouse#120311 removed it. That commit's own note in
`InterpreterSelectQuery.h` asks new callers to use `InterpreterSelectQueryAnalyzer`; a
scalar subquery of a standalone expression is the user's own `SELECT`, i.e. exactly that
case. The crash is not a regression of ClickHouse#120311: the same dereference and the same
interpreter construction exist on 26.9 and 26.8, where that setting's default of 1 selects
the analyzer arm as well.
The identical dereference was reached once before through `StorageMaterializedView` and
fixed at its origin by ClickHouse#107653. This is a second entry path, so the producer is fixed
rather than the storage: a null guard in `StorageDistributed` would have no arm to fall
back to and could only throw, turning a crash into a rejected statement that works on
26.9, and it would have to be repeated for every analyzer-only engine.
The interpreter swap carries over four behaviours of the old path, each matching the
analyzer's own scalar-subquery executor in
`src/Analyzer/Resolve/evaluateScalarSubqueryIfNeeded.cpp`:
* the materialized-view source substitution `JoinedTables::getLeftTableStorage` did,
through the `InterpreterSelectQueryAnalyzer` storage overload, so a scalar subquery
compiled during a view push still reads the inserted block;
* `use_structure_from_insertion_table_in_table_functions` in the subquery settings,
because `QueryAnalyzer` reads it from the scope context rather than from the query
context the pre-existing line mutates (that line stays, it is issue ClickHouse#52494's);
* `allow_experimental_parallel_reading_from_replicas = 0`, because `Planner`'s
constructor inspects the tree for parallel-replica candidates;
* `options.forceMaterializeCTE()`, because `collectMaterializedCTEs` returns nothing for
subquery options, so a materialized CTE would be read unpopulated.
Disabling parallel replicas on the subquery context alone is not enough, and the setting is
also stripped from a clone of the subquery AST. `QueryTreeBuilder::buildSelectExpression`
applies a SELECT's own `SETTINGS` clause onto the context it stamps on the `QueryNode`, and
`findQueryForParallelReplicas` reads the decision from that node context inside `Planner`'s
member-init list, i.e. inside the interpreter's constructor, where nothing can repair it
afterwards. Without the strip, a scalar subquery whose own clause turns parallel replicas on
and names a cluster that does not exist is rejected with `CLUSTER_DOESNT_EXIST` where it used
to succeed: measured on the constraint above with
`parallel_replicas_for_non_replicated_merge_tree = 1` in the same clause. Both spellings of the
aliased setting are stripped, the way the automatic-parallel-replicas probe in
`InterpreterSelectQueryAnalyzer` strips the settings it overrides, and from a clone because the
AST belongs to the statement being analysed rather than to this helper.
The test's session-level arm pins `automatic_parallel_replicas_mode = 0`, which is that
setting's own default. The test runner draws 2 for it in a quarter of runs, and with the
statement's `allow_experimental_parallel_reading_from_replicas = 1` inherited,
`InterpreterSelectQueryAnalyzer::buildContext` then clears `enable_parallel_replicas` on its
own context copy, so the subquery would never reach a cluster lookup and the arm would stop
exercising the strip at all in those runs.
The recursive nested-context walk the reference executor also does stays uncopied: it clones an
already-built tree whose nested nodes carry the original context, while this path builds the
tree from an AST with the subquery context, and `QueryTreeBuilder` stamps a copy of that context
onto every node it creates.
`usesViewSource()` lives on `IInterpreterUnionOrSelectQuery` and has no counterpart on
the analyzer interpreter, so both call sites ask the built query tree with the existing
`isStorageUsedInTree`. The answer is the same wherever the old flag was true and
conservative elsewhere: a scalar can only move from the global cache to the per-query
one, never the reverse.
Co-Authored-By: Claude Opus 5 <[email protected]>
Since ClickHouse#120311, `enable_analyzer = 0` is accepted and replaced with `1`. On the analyzer, a key-value `structure` whose value calls `hostName()` is rejected on a cluster read with `Code: 36 ... is not a constant expression`, and master rejects it the same way on plain `s3Cluster` (measured on master `6ee563bc`). The two arms that pinned the old analyzer to guard that shape therefore assert what master no longer accepts. The literal-operand `concat` arm stays, without the setting that is now a no-op: it reads the declared column (`2 2`) where master rejects it with `Code: 47`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e analyzer A standalone expression - a row policy, a `CHECK` constraint, a `TTL` expression - is compiled by `ExpressionAnalyzer`, and `ActionsMatcher::makeSet` built the plan of an `IN` subquery in it with the interpreter that preceded the analyzer. `StorageDistributed` resolves its read through a query tree and a planner context that interpreter never builds, and dereferences them unconditionally, so reading a `Distributed` table from such a subquery crashed the server. `IInterpreterUnionOrSelectQuery` used to set `allow_experimental_analyzer = 0` on the interpreter's own context, and the storages read under it took their AST arm. ClickHouse#120311 removed the assignment together with the arms it protected, which is what uncovered the dereference. It is the same defect as ClickHouse#121464, reached through a second producer: ClickHouse#121418 replaces the one in `ExecuteScalarSubqueriesVisitor`, which accounts for 27 of the 29 occurrences of the two sibling STIDs in the CI database over the last five days; the other two come through `interpretSubquery`, and the STID does not tell them apart because it is computed from the top of the stack, which both share. `makeSet` now builds the plan with `InterpreterSelectQueryAnalyzer`. What `interpretSubquery` does around it - a table name or a table function becomes `SELECT <columns> FROM it`, and the subquery gets its own context with the whole-query result limits lifted - is shared as `prepareSubquery` rather than duplicated. `makeSet` already built a query tree of the same subquery for its set key, so the analyzer was on this path before this change. Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=e96f004b984ced9a97237e99b3e744599a917870&name_0=MasterCI&name_1=Stress%20test%20%28arm_tsan%29 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Related: #118629
#118629 froze
enable_analyzerat1and left the query analysis that preceded the analyzer reachable through a handful of internal fallbacks, noting that removing it was the point of freezing the setting first. This is that removal: the old analysis is no longer a way a query can be analyzed.Nothing turns the analyzer off for a query anymore. A secondary query from an initiator older than 24.3 no longer carries
allow_experimental_analyzer = 0into this server. A value that reaches a query some other way - a settings profile from the server configuration,clickhouse-localon the command line, an initiator that sends it - is normalized inexecuteQuery, sogetSetting,system.query_logand a query this server sends on report the analysis that actually ran. ASQL SECURITY DEFINERorNONEbody is the one thing that does not run in the contextexecuteQuerynormalized - that one is built from the global context and then takes the definer's profile, the only place a0can still come from - sogetSQLSecurityOverriddenContextnormalizes it too.EXPLAIN AST, a view read by the old interpreter and a materialized view over aDistributedtable no longer switch the setting off for the query they run. AndInterpreterFactorybuildsInterpreterSelectQueryAnalyzerfor every shape of aSELECT,ASTSelectIntersectExceptQueryincluded - that one used to reach the old interpreter regardless of the setting, which the old interpreter then noticed and logged as a possible bug.Every
if (enable_analyzer)insrcnow has one arm, and the other one is gone: 76 files, from the storages that chose between a query tree and an AST down to the constant-expression evaluator and theisNullfamily. That makes a pile of code unreferenced, which goes with it - the parallel-replicas reading step built from an AST,StorageDistributed::getOptimizedQueryProcessingStage,rewriteSelectQuery, theEXPLAINplan-secrets guard (the analyzer masks secrets in the plan; the old analysis could not, so a plan dump had to be refused), andtryReuseStorageOrderingForWindowFunctions, an optimization that had been obsolete for as long as it was analyzer-gated.Three consumers that were still analyzed the old way are converted to the analyzer rather than dropped: mutations, the
format_schemaquery ofFormatSchemaInfo, and the row lookup ofMaterializedPostgreSQL. Mutations loseuse_analyzer_for_mutations, the server setting that was the escape hatch from the rollout that made them analyzer-analyzed; it is the last thing that could have asked for the old analysis.parallel_replicas_only_with_analyzerbecomes obsolete for the same reason - the condition it guarded can no longer be false.Not removed:
InterpreterSelectQuery,ExpressionAnalyzerandTreeRewriter. They are no longer how a query a user sends is analyzed, but they remain the machinery that compiles a standalone expression - aTTLexpression, a sharding key, a column default - and a syntheticSELECTover a source built in place. The projection machinery (ProjectionDescription,optimizeUseAggregateProjection) and the AST-based arms ofEXPLAIN SYNTAXandEXPLAIN ASTdo exactly that and never go through query analysis.InterpreterSelectQuerysays so in a comment now, so that no new caller is added; converting those remaining users is a separate change with its own risk.The one thing lost is that a pre-26.9 initiator no longer gets the query analysis it asks its replicas for.
test_analyzer_compatibility, whose initiator is a 24.2 server, covers that this server ignores the value instead of agreeing with it, and05210_analyzer_cannot_be_disabled_by_query_kindcovers the same for a client that declares a secondary query for itself.That has a visible cost the test now pins: the two analyses do not name the result columns the same way, and an initiator matches the block a shard returns by column name, so a query selecting a function written in non-canonical case (
hostname(), which the analyzer resolves tohostName()) fails on such an initiator withNOT_FOUND_COLUMN_IN_BLOCK. A cluster still running the older query analysis must setenable_analyzer = 1on every server before upgrading any of them to 26.10 - which is what the deprecation in 26.9 asked for. The known-incompatibility page says so now. In the other direction nothing changed: the initiator still forces the setting into the changes it sends, so a replica older than 26.9 is told to use the analyzer rather than left to its own profile.Verified locally: 2598 stateless tests (two shards of twelve) plus the
analyzer,explainandprojectionsets, each failure cross-checked against a control build of the same version in the same rig - no failure is attributable to this change.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The query analysis that preceded the analyzer is removed. It has not been selectable since 26.9, when
enable_analyzerbecame obsolete; now a server no longer uses it for a query another server sends either, so a cluster whose initiator is older than 26.10 gets the analyzer on this server regardless of what the initiator asks for. Such a mixed cluster can seeNOT_FOUND_COLUMN_IN_BLOCKon the old initiator, because the two analyses name the result columns differently - setenable_analyzer = 1on every server before upgrading any of them. Theuse_analyzer_for_mutationsserver setting is removed, andparallel_replicas_only_with_analyzeris obsolete.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/120311]
Version info
26.10.1.314-master(included in26.10and later)