[
https://issues.apache.org/jira/browse/HIVE-27193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17706513#comment-17706513
]
Oliver Schiller commented on HIVE-27193:
----------------------------------------
After poking a while around in the code and trying to understand how everything
plays together, I'm still uncertain where the catalog name should be prepended.
I don't know whether the following assumptions/invariants are correct:
* If the request object does not have its own catalog name field, the catalog
name is prepended and sent to the metastore via the dbname. This happens always
in class (Session)HiveMetaStoreClient.
* If a complete request object is passed to HiveMetaStoreClient, which is then
just passed along, the caller ensures that the catalog is prepended.
If they are correct, going through HiveMetaStoreClient following these
assumptions should ensure that a leading '@' does not cause issues since a
catalog is always prepended (however, if the catalog name is allowed to contain
#, another problem would emerge).
> Database names starting with '@' cause error during ALTER/DROP table.
> ---------------------------------------------------------------------
>
> Key: HIVE-27193
> URL: https://issues.apache.org/jira/browse/HIVE-27193
> Project: Hive
> Issue Type: Bug
> Components: Metastore, Standalone Metastore
> Affects Versions: 4.0.0-alpha-2
> Reporter: Oliver Schiller
> Priority: Major
>
> The creation of database that start with '@' is supported:
>
> {code:java}
> create database `@test`;{code}
>
> The creation of a table in this database works:
>
> {code:java}
> create table `@test`.testtable (c1 integer);{code}
> However, dropping or altering the table result in an error:
>
> {code:java}
> drop table `@test`.testtable;
> FAILED: SemanticException Unable to fetch table testtable. @test is prepended
> with the catalog marker but does not appear to have a catalog name in it
> Error: Error while compiling statement: FAILED: SemanticException Unable to
> fetch table testtable. @test is prepended with the catalog marker but does
> not appear to have a catalog name in it (state=42000,code=40000)
> alter table `@test`.testtable add columns (c2 integer);
> FAILED: SemanticException Unable to fetch table testtable. @test is prepended
> with the catalog marker but does not appear to have a catalog name in it
> Error: Error while compiling statement: FAILED: SemanticException Unable to
> fetch table testtable. @test is prepended with the catalog marker but does
> not appear to have a catalog name in it (state=42000,code=40000)
> {code}
>
> Relevant snippet of stack trace:
>
> {{}}
> {code:java}
> org.apache.hadoop.hive.metastore.api.MetaException: @TEST is prepended with
> the catalog marker but does not appear to have a catalog name in it at
> org.apache.hadoop.hive.metastore.utils.MetaStoreUtils.parseDbName(MetaStoreUtils.java:1031
> at
> org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.getTempTable(SessionHiveMetaStoreClient.java:651)
> at
> org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.getTable(SessionHiveMetaStoreClient.java:279)
> at
> org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.getTable(SessionHiveMetaStoreClient.java:273)
> at
> org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.getTable(SessionHiveMetaStoreClient.java:258)
> at
> org.apache.hadoop.hive.metastore.HiveMetaStoreClient.dropTable(HiveMetaStoreClient.java:1982)org.apache.hadoop.hive.metastore.HiveMetaStoreClient.dropTable(HiveMetaStoreClient.java:1957)
> ...{code}
> {{}}
>
> My suspicion is that this caused by the implementation of getTempTable and
> how it is called. The method getTempTable calls parseDbName assuming that the
> given dbname might be prefixed with a catalog name. I'm wondering whether
> this is correct at this layer. From poking a bit around, it appears to me
> that the catalog name is typically prepended when making the actual thrift
> call.
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)