This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 000972ae17 [fix](executor) fix some npe about getting catalog and add 
some error info (#15155)
000972ae17 is described below

commit 000972ae17a52e20e3c35e5c4556408c837c93fc
Author: xueweizhang <zxw520bl...@163.com>
AuthorDate: Mon Dec 19 14:25:52 2022 +0800

    [fix](executor) fix some npe about getting catalog and add some error info 
(#15155)
---
 .../src/main/java/org/apache/doris/analysis/AnalyzeStmt.java      | 2 +-
 .../src/main/java/org/apache/doris/analysis/DescribeStmt.java     | 2 +-
 fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java    | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyzeStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyzeStmt.java
index f5ea7fabb1..ecf34cd23c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyzeStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyzeStmt.java
@@ -105,7 +105,7 @@ public class AnalyzeStmt extends DdlStmt {
         String catalogName = tableName.getCtl();
         String dbName = tableName.getDb();
         String tblName = tableName.getTbl();
-        CatalogIf catalog = 
analyzer.getEnv().getCatalogMgr().getCatalog(catalogName);
+        CatalogIf catalog = 
analyzer.getEnv().getCatalogMgr().getCatalogOrAnalysisException(catalogName);
         DatabaseIf db = catalog.getDbOrAnalysisException(dbName);
         table = db.getTableOrAnalysisException(tblName);
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DescribeStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DescribeStmt.java
index c76db30c8a..37370394b9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DescribeStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DescribeStmt.java
@@ -134,7 +134,7 @@ public class DescribeStmt extends ShowStmt {
                     dbTableName.toString());
         }
 
-        CatalogIf catalog = 
Env.getCurrentEnv().getCatalogMgr().getCatalog(dbTableName.getCtl());
+        CatalogIf catalog = 
Env.getCurrentEnv().getCatalogMgr().getCatalogOrAnalysisException(dbTableName.getCtl());
         DatabaseIf db = catalog.getDbOrAnalysisException(dbTableName.getDb());
         TableIf table = db.getTableOrAnalysisException(dbTableName.getTbl());
 
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
index 408c6c2891..adaee85393 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
@@ -761,7 +761,7 @@ public class ShowExecutor {
     private void handleShowTableStatus() throws AnalysisException {
         ShowTableStatusStmt showStmt = (ShowTableStatusStmt) stmt;
         List<List<String>> rows = Lists.newArrayList();
-        DatabaseIf<TableIf> db = 
ctx.getCurrentCatalog().getDbNullable(showStmt.getDb());
+        DatabaseIf<TableIf> db = 
ctx.getCurrentCatalog().getDbOrAnalysisException(showStmt.getDb());
         if (db != null) {
             PatternMatcher matcher = null;
             if (showStmt.getPattern() != null) {
@@ -865,7 +865,7 @@ public class ShowExecutor {
     // Show create table
     private void handleShowCreateTable() throws AnalysisException {
         ShowCreateTableStmt showStmt = (ShowCreateTableStmt) stmt;
-        DatabaseIf db = 
ctx.getEnv().getCatalogMgr().getCatalog(showStmt.getCtl())
+        DatabaseIf db = 
ctx.getEnv().getCatalogMgr().getCatalogOrAnalysisException(showStmt.getCtl())
                 .getDbOrAnalysisException(showStmt.getDb());
         TableIf table = db.getTableOrAnalysisException(showStmt.getTable());
         List<List<String>> rows = Lists.newArrayList();
@@ -1877,10 +1877,10 @@ public class ShowExecutor {
         resultSet = new ShowResultSet(showStmt.getMetaData(), results);
     }
 
-    private void handleShowDynamicPartition() {
+    private void handleShowDynamicPartition() throws AnalysisException {
         ShowDynamicPartitionStmt showDynamicPartitionStmt = 
(ShowDynamicPartitionStmt) stmt;
         List<List<String>> rows = Lists.newArrayList();
-        DatabaseIf db = 
ctx.getEnv().getInternalCatalog().getDbNullable(showDynamicPartitionStmt.getDb());
+        DatabaseIf db = 
ctx.getEnv().getInternalCatalog().getDbOrAnalysisException(showDynamicPartitionStmt.getDb());
         if (db != null && (db instanceof Database)) {
             List<Table> tableList = db.getTables();
             for (Table tbl : tableList) {


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

Reply via email to