Description
When creating a kudu/iceberg table, we check whether it exists in HMS before invoking the createTable HMS RPC:
https://github.com/apache/impala/blob/08501cef2df16991bbd99656c696b978f08aeebe/fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java#L3483
https://github.com/apache/impala/blob/08501cef2df16991bbd99656c696b978f08aeebe/fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java#L3714
However, when creating a hdfs table, we just invoke the createTable RPC (when the table is not in catalog cache):
https://github.com/apache/impala/blob/08501cef2df16991bbd99656c696b978f08aeebe/fe/src/main/java/org/apache/impala/service/CatalogOpExecutor.java#L3563
This results in different error messages when the table does exist in HMS but not exist in catalog cache. E.g. I create a table in Hive and recreate it in an Impala cluster that has disabled HMS event processing, the error message is
Query: create table hive_tbl(id int) ERROR: ImpalaRuntimeException: Error making 'createTable' RPC to Hive Metastore: CAUSED BY: AlreadyExistsException: Table hive.default.hive_tbl already exists
Creating the same table in kudu format, got different error message:
Query: create table hive_tbl (id int, name string, primary key(id)) partition by hash(id) partitions 3 stored as kudu +-----------------------+ | summary | +-----------------------+ | Table already exists. | +-----------------------+ Fetched 1 row(s) in 1.63s
We can add the same check in creating HDFS tables and provide the same error message.
BTW, we might need to mention Metastore: "Table already exists in Metastore".