You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/08/19 01:59:33 UTC

[GitHub] [incubator-doris] HangyuanLiu commented on a change in pull request #4253: Support more materialized view syntax

HangyuanLiu commented on a change in pull request #4253:
URL: https://github.com/apache/incubator-doris/pull/4253#discussion_r472590847



##########
File path: fe/fe-core/src/main/java/org/apache/doris/analysis/DropMaterializedViewStmt.java
##########
@@ -38,38 +43,91 @@
  */
 public class DropMaterializedViewStmt extends DdlStmt {
 
-    private String mvName;
-    private TableName tableName;
     private boolean ifExists;
+    private final TableName dbMvName;
+    private final TableName dbTblName;
 
-    public DropMaterializedViewStmt(boolean ifExists, String mvName, TableName tableName) {
-        this.mvName = mvName;
-        this.tableName = tableName;
+    public DropMaterializedViewStmt(boolean ifExists, TableName dbMvName, TableName dbTblName) {
         this.ifExists = ifExists;
+        this.dbMvName = dbMvName;
+        this.dbTblName = dbTblName;
+    }
+
+    public boolean isSetIfExists() {
+        return ifExists;
     }
 
     public String getMvName() {
-        return mvName;
+        return dbMvName.getTbl();
     }
 
-    public TableName getTableName() {
-        return tableName;
+    public String getTblName() {
+        if (dbTblName != null) {
+            return dbTblName.getTbl();
+        } else {
+            return null;
+        }
     }
 
-    public boolean isIfExists() {
-        return ifExists;
+    public String getDbName() {
+        if (dbTblName != null) {
+            return dbTblName.getDb();
+        } else {
+            return dbMvName.getDb();
+        }
     }
 
     @Override
     public void analyze(Analyzer analyzer) throws UserException {
-        if (Strings.isNullOrEmpty(mvName)) {
-            throw new AnalysisException("The materialized name could not be empty or null.");
+        if (dbTblName != null && !Strings.isNullOrEmpty(dbMvName.getDb())) {
+            throw new AnalysisException("Syntax drop materialized view [mv-name] from db.name mush specify database name explicitly in `from`");

Review comment:
       If db set in from , it mush not be set in view name




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org