Repository navigation
Cherry pick #122345 to 26.3: Fix LOGICAL_ERROR on lambda over an Array(Tuple(...)) - #123250
Merged
Merged
Conversation
Address review: resolving the view source during analysis applied to every context carrying it, including the inner query of an ordinary `VIEW` referenced from the materialized view query. Such a view then read only the inserted block instead of the whole table. Skip the early resolution when `isViewInnerQuery` is set, which matches how the inner query of a view resolved the table before. Add `05291_mv_ordinary_view_over_source_reads_table` for that case, and make `05241_mv_insert_alter_source_column_during_insert` wait until the first block has passed through the view before running the `ALTER`, with more blocks left after it, so it does not depend on timing on slow builds. Without the fix the test fails with `Cannot capture column 3 because it has incompatible type`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The `view_source` rewrites of the right-hand side of `IN` (`resolveFunction`) and of scalar subqueries (`evaluateScalarSubqueryIfNeeded`) now skip the inner query of an ordinary view (`isViewInnerQuery`), like the table resolution in `IdentifierResolver::tryResolveTableIdentifier`. Otherwise an ordinary view referenced from a materialized view query saw only the pushed block in those subqueries instead of the table. Address review: #122345 (comment) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…the table With `analyzer_inline_views = 1`, `QueryAnalyzer::inlineViewSubqueryIfNeeded` resolves the view body with `StorageView::getViewSubqueryContext`, which did not mark the context as the inner query of a view, so the body inherited `view_source` and resolved the source table of a materialized view to the inserted block. Mark that context with `setIsViewInnerQuery`, like `getViewContext` does for a view that is not inlined. `replaceStorageInQueryTree` also swapped the storage in every table reference of the join tree, including those inside an inlined view body. It no longer descends into queries of a view that is inlined into a query outside of views. Address review: #122345 (comment) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…a materialized view query
`Context::createCopy` preserves `view_source`, so `createLocalPlan` analyzed the local shard of a
`remote` or `Distributed` read inside a materialized view query with the inserted block standing in
for the source table: `(SELECT count() FROM remote('127.0.0.1', db, src))` counted the block, not
the table. Before the early resolution in `IdentifierResolver::tryResolveTableIdentifier`, the swap
was done only on the view query's own tree, so the local shard read the table, like the remote
shards do. Clear the view source in the local shard's context.
New test `05294_mv_source_remote_local_shard_reads_table`: without the fix it prints `0` rows
for both reads, with the fix `10`.
Addresses review: #122345 (comment)
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-authored-by: George Larionov <[email protected]>
Fix LOGICAL_ERROR on lambda over an `Array(Tuple(...))`
…to 26.3 Resolve the conflict in `StorageView.cpp` and reconcile the change with 26.3: - 26.3 does not have `Context::isViewInnerQuery` (added on master by #94359, not backported). Add the `is_view_inner_query` flag to `Context` and set it in `getViewContext` of `StorageView`, so the inner query of an ordinary view reads the table itself, not the inserted block of a materialized view. - 26.3 does not have view inlining in the analyzer (`StorageView::getViewSubqueryContext`, `analyzer_inline_views`, from #100830). Drop that part and the test `05293_mv_ordinary_view_over_source_inlined`. - Use `QueryNode::getJoinTree` instead of `getJoinTreeNodeTyped`, which does not exist in 26.3. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
|
🕵 Resolved the conflicts by merging
All changed translation units compile against the 26.3 tree (checked with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original pull-request #122345
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job