[fix](mv) Isolate temporary MV pre-rewrite state - #67780
Draft
morrySnow wants to merge 1 commit into
Draft
Conversation
MV pre-rewrite normalized CTE children with the main statement context, allowing temporary producer and consumer caches to leak into the formal rewrite. This could either bypass view-column privilege checks or leave partial CTE state that failed with an internal error.\n\nCreate an independent temporary statement context for pre-rewrite state while sharing statement-scoped ID and alias allocation. Install it for utilities that read the connection context, restore the original context in a finally block, and cover state isolation plus view-column authorization in unit and regression tests.
morrySnow
requested review from
924060929,
englefly and
starocean999
as code owners
September 10, 2026 07:02
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
morrySnow
marked this pull request as draft
September 10, 2026 07:08
Contributor
TPC-H: Total hot run time: 16763 ms |
Contributor
TPC-DS: Total hot run time: 81673 ms |
Contributor
ClickBench: Total hot run time: 14.6 s |
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.
What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary:
MV pre-rewrite normalizes CTE children before the main rewrite. It reused the main statement context, allowing temporary CTE producer and consumer caches to affect later privilege checking and leaving partial CTE maps that could fail with an internal error.
This change gives temporary pre-rewrite its own mutable statement state while keeping ID and generated-alias allocation in the original statement scope. It temporarily installs the isolated context for utilities that access the connection directly and restores the original context in a
finallyblock.The regression test creates a view for which a user can select one column but not another, then exercises direct access and CTE queries under both default and forced pre-rewrite strategies. All paths must return the same permission error.
Release note
None
Check List (For Author)