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 2022/05/05 14:54:11 UTC

[GitHub] [incubator-doris] stalary opened a new pull request, #9391: [Feature] show create materialized view

stalary opened a new pull request, #9391:
URL: https://github.com/apache/incubator-doris/pull/9391

   # Proposed changes
   
   Issue Number: close (https://github.com/apache/incubator-doris/issues/9196)
   
   ## Problem Summary:
   
   Describe the overview of changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: (Yes/No/I Don't know)
   2. Has unit tests been added: (Yes/No/No Need)
   3. Has document been added or modified: (Yes/No/No Need)
   4. Does it need to update dependencies: (Yes/No)
   5. Are there any changes that cannot be rolled back: (Yes/No)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] stalary commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
stalary commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1120388058

   done. @morrySnow 


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] stalary commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
stalary commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1120214463

   > Better with `md` file.
   
   Thanks. done


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] stalary commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
stalary commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1120123722

   > It's better to add a `show create materialized view` doc pointer to the materialized view document
   
   done


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] qidaye commented on a diff in pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
qidaye commented on code in PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#discussion_r867318318


##########
docs/en/advanced/materialized-view.md:
##########
@@ -148,11 +148,13 @@ You can see that the current `mv_test` table has three materialized views: mv\_1
 
 If the user no longer needs the materialized view, you can delete the materialized view by 'DROP' commen.
 
-The specific syntax can be viewed through the following command:
+You can view the specific syntax[SHOW CREATE MATERIALIZED VIEW](../sql-manual/sql-reference/Data-Definition-Statements/Drop/DROP-MATERIALIZED-VIEW.html)
 
-```
-HELP DROP MATERIALIZED VIEW
-```
+### View the materialized view that has been created
+
+Users can view the created materialized views by using commands
+
+You can view the specific syntax[SHOW CREATE MATERIALIZED VIEW](../sql-manual/sql-reference/Show-Statements/SHOW-CREATE-MATERIALIZED-VIEW.html)

Review Comment:
   ```suggestion
   You can view the specific syntax[SHOW CREATE MATERIALIZED VIEW](../sql-manual/sql-reference/Show-Statements/SHOW-CREATE-MATERIALIZED-VIEW.md)
   ```



##########
docs/en/advanced/materialized-view.md:
##########
@@ -148,11 +148,13 @@ You can see that the current `mv_test` table has three materialized views: mv\_1
 
 If the user no longer needs the materialized view, you can delete the materialized view by 'DROP' commen.
 
-The specific syntax can be viewed through the following command:
+You can view the specific syntax[SHOW CREATE MATERIALIZED VIEW](../sql-manual/sql-reference/Data-Definition-Statements/Drop/DROP-MATERIALIZED-VIEW.html)

Review Comment:
   ```suggestion
   You can view the specific syntax[SHOW CREATE MATERIALIZED VIEW](../sql-manual/sql-reference/Data-Definition-Statements/Drop/DROP-MATERIALIZED-VIEW.md)
   ```



##########
docs/zh-CN/advanced/materialized-view.md:
##########
@@ -146,7 +146,11 @@ MySQL [test]> desc mv_test all;
 
 具体的语法可查看[DROP MATERIALIZED VIEW](../sql-manual/sql-reference/Data-Definition-Statements/Drop/DROP-MATERIALIZED-VIEW.html) 
 
+### 查看已创建的物化视图
 
+用户可以通过命令查看已创建的物化视图的
+
+具体的语法可查看[SHOW CREATE MATERIALIZED VIEW](../sql-manual/sql-reference/Show-Statements/SHOW-CREATE-MATERIALIZED-VIEW.html)

Review Comment:
   ```suggestion
   具体的语法可查看[SHOW CREATE MATERIALIZED VIEW](../sql-manual/sql-reference/Show-Statements/SHOW-CREATE-MATERIALIZED-VIEW.md)
   ```



##########
docs/zh-CN/advanced/materialized-view.md:
##########
@@ -146,7 +146,11 @@ MySQL [test]> desc mv_test all;
 
 具体的语法可查看[DROP MATERIALIZED VIEW](../sql-manual/sql-reference/Data-Definition-Statements/Drop/DROP-MATERIALIZED-VIEW.html) 

Review Comment:
   ```suggestion
   具体的语法可查看[DROP MATERIALIZED VIEW](../sql-manual/sql-reference/Data-Definition-Statements/Drop/DROP-MATERIALIZED-VIEW.md) 
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] qidaye commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
qidaye commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1120128649

   Thanks for your quick fix.
   > It's better to add a `show create materialized view` doc pointer to the materialized view document
   
   What I mean is to add a note in the materialized view document showing the creation statement, like drop
   https://github.com/apache/incubator-doris/blob/98bfeaf560f7ac04f2324499e4dc7cc3bbf0a437/docs/en/advanced/materialized-view.md?plain=1#L147-L155


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] qidaye commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
qidaye commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1120576605

   LGTM
   @stalary please resolve confilicts.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] stalary commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
stalary commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1120123330

   > It's better to add a `show create materialized view` doc pointer to the materialized view document
   
   Thanks,I forgot that, and I'm going to add it


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] github-actions[bot] commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1120586055

   PR approved by at least one committer and no changes requested.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] github-actions[bot] commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1119215309

   PR approved by anyone and no changes requested.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] qidaye commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
qidaye commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1120123023

   It's better to add a `show create materialized view` doc pointer to the materialized view document


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] hf200012 commented on a diff in pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
hf200012 commented on code in PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#discussion_r866011691


##########
fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java:
##########
@@ -2178,4 +2182,23 @@ private void handleAdminDiagnoseTablet() {
         resultSet = new ShowResultSet(showMetaData, resultRowSet);
     }
 
+    private void handleShowCreateMaterializedView() throws AnalysisException {
+        ShowCreateMaterializedViewStmt showStmt = (ShowCreateMaterializedViewStmt) stmt;
+        Database db = Catalog.getCurrentCatalog().getDbOrAnalysisException(showStmt.getTableName().getDb());
+        Table table = db.getTableOrAnalysisException(showStmt.getTableName().getTbl());
+        OlapTable baseTable = ((OlapTable) table);
+        Long indexIdByName = baseTable.getIndexIdByName(showStmt.getMvName());
+        System.out.println(indexIdByName);

Review Comment:
   remove



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] github-actions[bot] commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1120131556

   PR approved by at least one committer and no changes requested.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] morningman merged pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
morningman merged PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] github-actions[bot] commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1119215293

   PR approved by at least one committer and no changes requested.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] stalary commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
stalary commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1120584207

   > LGTM @stalary please resolve confilicts.
   
   done.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] stalary commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
stalary commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1120141816

   > Thanks for your quick fix.
   > 
   > > It's better to add a `show create materialized view` doc pointer to the materialized view document
   > 
   > What I mean is to add a note in the materialized view document showing the creation statement, like drop
   > 
   > https://github.com/apache/incubator-doris/blob/98bfeaf560f7ac04f2324499e4dc7cc3bbf0a437/docs/en/advanced/materialized-view.md?plain=1#L147-L155
   
   done


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] morrySnow commented on a diff in pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
morrySnow commented on code in PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#discussion_r867451804


##########
fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java:
##########
@@ -2178,4 +2182,25 @@ private void handleAdminDiagnoseTablet() {
         resultSet = new ShowResultSet(showMetaData, resultRowSet);
     }
 
+    private void handleShowCreateMaterializedView() throws AnalysisException {
+        List<List<String>> resultRowSet = new ArrayList<>();
+        ShowCreateMaterializedViewStmt showStmt = (ShowCreateMaterializedViewStmt) stmt;
+        Database db = Catalog.getCurrentCatalog().getDbOrAnalysisException(showStmt.getTableName().getDb());
+        Table table = db.getTableOrAnalysisException(showStmt.getTableName().getTbl());
+        OlapTable baseTable = ((OlapTable) table);

Review Comment:
   should check table type before cast



##########
fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java:
##########
@@ -2178,4 +2182,25 @@ private void handleAdminDiagnoseTablet() {
         resultSet = new ShowResultSet(showMetaData, resultRowSet);
     }
 
+    private void handleShowCreateMaterializedView() throws AnalysisException {
+        List<List<String>> resultRowSet = new ArrayList<>();
+        ShowCreateMaterializedViewStmt showStmt = (ShowCreateMaterializedViewStmt) stmt;
+        Database db = Catalog.getCurrentCatalog().getDbOrAnalysisException(showStmt.getTableName().getDb());
+        Table table = db.getTableOrAnalysisException(showStmt.getTableName().getTbl());
+        OlapTable baseTable = ((OlapTable) table);
+        Long indexIdByName = baseTable.getIndexIdByName(showStmt.getMvName());
+        MaterializedIndexMeta meta = baseTable.getIndexMetaByIndexId(indexIdByName);
+        if (meta == null || meta.getDefineStmt() == null) {

Review Comment:
   ```suggestion
           if (meta != null && meta.getDefineStmt() != null) {
               String originStmt = meta.getDefineStmt().originStmt;
               List<String> data = new ArrayList<>();
               data.add(showStmt.getTableName().getTbl());
               data.add(showStmt.getMvName());
               data.add(originStmt);
               resultRowSet.add(data);
           }
           resultSet = new ShowResultSet(showStmt.getMetaData(), resultRowSet);
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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


[GitHub] [incubator-doris] github-actions[bot] commented on pull request #9391: [Feature] show create materialized view

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #9391:
URL: https://github.com/apache/incubator-doris/pull/9391#issuecomment-1120120633

   PR approved by at least one committer and no changes requested.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

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