Closed
Conversation
Contributor
Reviewer's GuideRefactor materialized view handling in StatementAnalyzer by separating data‐consistency and non‐consistency paths, centralizing recursion checks, and adding permission enforcement with on‐the‐fly view query processing when consistency is disabled. Sequence diagram for materialized view handling in StatementAnalyzersequenceDiagram
participant Session
participant StatementAnalyzer
participant Analysis
participant MaterializedView
participant AccessControlReferences
participant SqlParser
participant WarningCollector
Session->>StatementAnalyzer: visitTable(table, scope)
StatementAnalyzer->>Analysis: getStatement()
StatementAnalyzer->>Analysis: getMaterializedViewAnalysisState(table)
alt Data consistency enabled
StatementAnalyzer->>MaterializedView: processMaterializedView(table, name, scope, materializedView)
Note over StatementAnalyzer,MaterializedView: If not visited
StatementAnalyzer->>StatementAnalyzer: throw SemanticException if recursive
else Data consistency disabled
StatementAnalyzer->>AccessControlReferences: addMaterializedViewDefinitionReference(name, materializedViewDefinition)
StatementAnalyzer->>SqlParser: createStatement(materializedViewDefinition.getOriginalSql(), parsingOptions)
StatementAnalyzer->>Analysis: registerMaterializedViewForAnalysis(name, table, originalSql)
StatementAnalyzer->>StatementAnalyzer: process(viewQuery, scope)
StatementAnalyzer->>Analysis: unregisterMaterializedViewForAnalysis(table)
end
Class diagram for updated materialized view analysis in StatementAnalyzerclassDiagram
class StatementAnalyzer {
+visitTable(table, scope)
+processMaterializedView(table, name, scope, materializedView)
+process(viewQuery, scope)
}
class Analysis {
+getStatement()
+getMaterializedViewAnalysisState(table)
+registerMaterializedViewForAnalysis(name, table, originalSql)
+unregisterMaterializedViewForAnalysis(table)
+getAccessControlReferences()
}
class MaterializedViewAnalysisState {
+isNotVisited()
+isVisited()
}
class AccessControlReferences {
+addMaterializedViewDefinitionReference(name, materializedViewDefinition)
}
class MaterializedViewDefinition {
+getOriginalSql()
}
class SqlParser {
+createStatement(sql, parsingOptions)
}
class Query {}
class WarningCollector {}
StatementAnalyzer --> Analysis
StatementAnalyzer --> SqlParser
StatementAnalyzer --> MaterializedViewAnalysisState
StatementAnalyzer --> AccessControlReferences
StatementAnalyzer --> MaterializedViewDefinition
StatementAnalyzer --> Query
StatementAnalyzer --> WarningCollector
Analysis --> AccessControlReferences
Analysis --> MaterializedViewAnalysisState
MaterializedViewDefinition --> SqlParser
Flow diagram for materialized view decision logic in StatementAnalyzerflowchart TD
A["visitTable(table, scope)"] --> B{Is materialized view present?}
B -- No --> C["Proceed as table"]
B -- Yes --> D{Is statement a Query?}
D -- No --> C
D -- Yes --> E{Is data consistency enabled?}
E -- Yes --> F["Get MaterializedViewAnalysisState"]
F --> G{isNotVisited?}
G -- Yes --> H["processMaterializedView"]
G -- No --> I{isVisited?}
I -- Yes --> J["Throw SemanticException (recursive)"]
I -- No --> C
E -- No --> K["Add permission reference"]
K --> L["Parse original SQL"]
L --> M["Register for analysis"]
M --> N["Process viewQuery"]
N --> O["Unregister from analysis"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
zation99
added a commit
to zation99/presto
that referenced
this pull request
Nov 14, 2025
Summary: Pull Request resolved: prestodb#26622 Differential Revision: D87036805
7663673 to
8f4acc4
Compare
Summary: Pull Request resolved: prestodb#26622 Differential Revision: D87036805
8f4acc4 to
6f9c58f
Compare
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.
Differential Revision: D87036805