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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org