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

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

commit 17c4d82093038d20165539b901e0f88928512d87
Author: slothever <[email protected]>
AuthorDate: Tue Oct 17 22:53:53 2023 +0800

    [fix](multi-catalog)add exception for unsupported hive input format (#25490)
    
    add exception for unsupported hive input format
---
 .../org/apache/doris/catalog/external/HMSExternalTable.java    | 10 ++++++++--
 .../external_table_p2/hive/test_external_catalog_hive.groovy   |  7 +++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/external/HMSExternalTable.java
 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/external/HMSExternalTable.java
index 740a35f9572..d14b6c4ce79 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/external/HMSExternalTable.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/external/HMSExternalTable.java
@@ -198,9 +198,15 @@ public class HMSExternalTable extends ExternalTable {
      */
     private boolean supportedHiveTable() {
         String inputFileFormat = remoteTable.getSd().getInputFormat();
-        boolean supportedFileFormat = inputFileFormat != null && 
SUPPORTED_HIVE_FILE_FORMATS.contains(inputFileFormat);
+        if (inputFileFormat == null) {
+            return false;
+        }
+        boolean supportedFileFormat = 
SUPPORTED_HIVE_FILE_FORMATS.contains(inputFileFormat);
+        if (!supportedFileFormat) {
+            throw new IllegalArgumentException("Unsupported hive input format: 
" + inputFileFormat);
+        }
         LOG.debug("hms table {} is {} with file format: {}", name, 
remoteTable.getTableType(), inputFileFormat);
-        return supportedFileFormat;
+        return true;
     }
 
     /**
diff --git 
a/regression-test/suites/external_table_p2/hive/test_external_catalog_hive.groovy
 
b/regression-test/suites/external_table_p2/hive/test_external_catalog_hive.groovy
index b2ad3eeb88b..e15b833f06c 100644
--- 
a/regression-test/suites/external_table_p2/hive/test_external_catalog_hive.groovy
+++ 
b/regression-test/suites/external_table_p2/hive/test_external_catalog_hive.groovy
@@ -109,6 +109,13 @@ suite("test_external_catalog_hive", "p2") {
         qt_par_fields_in_file_orc5 """ select * from 
multi_catalog.par_fields_in_file_orc where month = 8 and year = 2022 order by 
id; """
         qt_par_fields_in_file_parquet5 """ select * from 
multi_catalog.par_fields_in_file_parquet where month = 8 and year = 2022 order 
by id; """
 
+        // test unsupported input format query
+        try {
+            sql """ select * from 
multi_catalog.unsupported_input_format_empty; """
+        } catch (Exception e) {
+            assertTrue(e.getMessage().contains("Unsupported hive input format: 
com.hadoop.mapred.DeprecatedLzoTextInputFormat"))
+        }
+
         // test remember last used database after switch / rename catalog
         sql """switch ${catalog_name};"""
 


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

Reply via email to