-
Notifications
You must be signed in to change notification settings - Fork 5.5k
fix: Check MV base table permission when stitching disabled #26580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2089,15 +2089,30 @@ protected Scope visitTable(Table table, Optional<Scope> scope) | |
| optionalMaterializedView.get().getTable()); | ||
| } | ||
| Statement statement = analysis.getStatement(); | ||
| if (isMaterializedViewDataConsistencyEnabled(session) && optionalMaterializedView.isPresent() && statement instanceof Query) { | ||
| // When the materialized view has already been expanded, do not process it. Just use it as a table. | ||
| MaterializedViewAnalysisState materializedViewAnalysisState = analysis.getMaterializedViewAnalysisState(table); | ||
| if (optionalMaterializedView.isPresent() && statement instanceof Query) { | ||
| if (isMaterializedViewDataConsistencyEnabled(session)) { | ||
| // When the materialized view has already been expanded, do not process it. Just use it as a table. | ||
| MaterializedViewAnalysisState materializedViewAnalysisState = analysis.getMaterializedViewAnalysisState(table); | ||
|
|
||
| if (materializedViewAnalysisState.isNotVisited()) { | ||
| return processMaterializedView(table, name, scope, optionalMaterializedView.get()); | ||
| if (materializedViewAnalysisState.isNotVisited()) { | ||
| return processMaterializedView(table, name, scope, optionalMaterializedView.get()); | ||
| } | ||
| if (materializedViewAnalysisState.isVisited()) { | ||
| throw new SemanticException(MATERIALIZED_VIEW_IS_RECURSIVE, table, "Materialized view is recursive"); | ||
| } | ||
| } | ||
| if (materializedViewAnalysisState.isVisited()) { | ||
| throw new SemanticException(MATERIALIZED_VIEW_IS_RECURSIVE, table, "Materialized view is recursive"); | ||
| else { | ||
| // when stitching is not enabled, still check permission of each base table | ||
| MaterializedViewDefinition materializedViewDefinition = optionalMaterializedView.get(); | ||
| analysis.getAccessControlReferences().addMaterializedViewDefinitionReference(name, materializedViewDefinition); | ||
|
|
||
| Query viewQuery = (Query) sqlParser.createStatement( | ||
| materializedViewDefinition.getOriginalSql(), | ||
| createParsingOptions(session, warningCollector)); | ||
|
|
||
| analysis.registerMaterializedViewForAnalysis(name, table, materializedViewDefinition.getOriginalSql()); | ||
| process(viewQuery, scope); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this might conflict with the changes in PR #26521. cc: @tdcmeehan
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had offline discussion with @tdcmeehan . There is no conflict given how legacy MV is handled separately. |
||
| analysis.unregisterMaterializedViewForAnalysis(table); | ||
zation99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.