-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor] Add DML Statement Analyzer to unify some dml analyze logic…
…al (#53974)
- Loading branch information
1 parent
aa3928e
commit a852995
Showing
5 changed files
with
75 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
53 changes: 53 additions & 0 deletions
53
fe/fe-core/src/main/java/com/starrocks/sql/analyzer/DMLStmtAnalyzer.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2021-present StarRocks, Inc. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.starrocks.sql.analyzer; | ||
|
||
import com.starrocks.qe.ConnectContext; | ||
import com.starrocks.sql.ast.AstVisitor; | ||
import com.starrocks.sql.ast.DeleteStmt; | ||
import com.starrocks.sql.ast.DmlStmt; | ||
import com.starrocks.sql.ast.InsertStmt; | ||
import com.starrocks.sql.ast.UpdateStmt; | ||
|
||
public class DMLStmtAnalyzer { | ||
public static void analyze(DmlStmt stmt, ConnectContext context) { | ||
new DMLStmtAnalyzer.DMLStmtAnalyzerVisitor().analyze(stmt, context); | ||
} | ||
|
||
static class DMLStmtAnalyzerVisitor implements AstVisitor<Void, ConnectContext> { | ||
public void analyze(DmlStmt dmlStmt, ConnectContext context) { | ||
dmlStmt.getTableName().normalization(context); | ||
visit(dmlStmt, context); | ||
} | ||
|
||
@Override | ||
public Void visitInsertStatement(InsertStmt stmt, ConnectContext context) { | ||
InsertAnalyzer.analyze(stmt, context); | ||
return null; | ||
} | ||
|
||
@Override | ||
public Void visitUpdateStatement(UpdateStmt stmt, ConnectContext context) { | ||
UpdateAnalyzer.analyze(stmt, context); | ||
return null; | ||
} | ||
|
||
@Override | ||
public Void visitDeleteStatement(DeleteStmt stmt, ConnectContext context) { | ||
DeleteAnalyzer.analyze(stmt, context); | ||
return null; | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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