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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 2e8f3418142 [opt](hive) make supported hive table error msg clearer 
(#41616) (#41852)
2e8f3418142 is described below

commit 2e8f3418142aaad79ec56ee0fbc86a2913ecaa60
Author: Rayner Chen <[email protected]>
AuthorDate: Tue Oct 15 18:14:57 2024 +0800

    [opt](hive) make supported hive table error msg clearer (#41616) (#41852)
    
    bp #41616
---
 .../src/main/java/org/apache/doris/analysis/Analyzer.java    |  8 ++++++--
 .../src/main/java/org/apache/doris/common/ErrorCode.java     |  2 +-
 .../org/apache/doris/datasource/hive/HMSExternalTable.java   | 12 +++++-------
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
index b1b0d66b585..8a3aa47fc17 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
@@ -41,6 +41,7 @@ import org.apache.doris.common.Pair;
 import org.apache.doris.common.UserException;
 import org.apache.doris.common.util.TimeUtils;
 import org.apache.doris.datasource.hive.HMSExternalTable;
+import org.apache.doris.nereids.exceptions.NotSupportedException;
 import org.apache.doris.planner.AggregationNode;
 import org.apache.doris.planner.AnalyticEvalNode;
 import org.apache.doris.planner.PlanNode;
@@ -846,11 +847,14 @@ public class Analyzer {
         // Now hms table only support a bit of table kinds in the whole hive 
system.
         // So Add this strong checker here to avoid some undefine behaviour in 
doris.
         if (table.getType() == TableType.HMS_EXTERNAL_TABLE) {
-            if (!((HMSExternalTable) table).isSupportedHmsTable()) {
+            try {
+                ((HMSExternalTable) table).isSupportedHmsTable();
+            } catch (NotSupportedException e) {
                 
ErrorReport.reportAnalysisException(ErrorCode.ERR_NONSUPPORT_HMS_TABLE,
                         table.getName(),
                         ((HMSExternalTable) table).getDbName(),
-                        tableName.getCtl());
+                        tableName.getCtl(),
+                        e.getMessage());
             }
             if (Config.enable_query_hive_views) {
                 if (((HMSExternalTable) table).isView()
diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java
index 68e15e7ee46..2d98f36ad8a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java
@@ -1199,7 +1199,7 @@ public enum ErrorCode {
     ERR_CATALOG_ACCESS_DENIED(5087, new byte[]{'4', '2', '0', '0', '0'},
             "Access denied for user '%s' to catalog '%s'"),
     ERR_NONSUPPORT_HMS_TABLE(5088, new byte[]{'4', '2', '0', '0', '0'},
-            "Nonsupport hive metastore table named '%s' in database '%s' with 
catalog '%s'."),
+            "Nonsupport hive metastore table named '%s' in database '%s' with 
catalog '%s'. %s"),
     ERR_TABLE_NAME_LENGTH_LIMIT(5089, new byte[]{'4', '2', '0', '0', '0'}, 
"Table name length exceeds limit, "
      + "the length of table name '%s' is %d which is greater than the 
configuration 'table_name_length_limit' (%d)."),
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java
 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java
index f012601b82f..74d9e3c56e6 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HMSExternalTable.java
@@ -167,14 +167,11 @@ public class HMSExternalTable extends ExternalTable 
implements MTMVRelatedTableI
         super(id, name, catalog, dbName, TableType.HMS_EXTERNAL_TABLE);
     }
 
+    // Will throw NotSupportedException if not supported hms table.
+    // Otherwise, return true.
     public boolean isSupportedHmsTable() {
-        try {
-            makeSureInitialized();
-            return true;
-        } catch (NotSupportedException e) {
-            LOG.warn("Not supported hms table, message: {}", e.getMessage());
-            return false;
-        }
+        makeSureInitialized();
+        return true;
     }
 
     protected synchronized void makeSureInitialized() {
@@ -191,6 +188,7 @@ public class HMSExternalTable extends ExternalTable 
implements MTMVRelatedTableI
                 } else if (supportedHiveTable()) {
                     dlaType = DLAType.HIVE;
                 } else {
+                    // Should not reach here. Because `supportedHiveTable` 
will throw exception if not return true.
                     throw new NotSupportedException("Unsupported dlaType for 
table: " + getNameWithFullQualifiers());
                 }
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to