Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading exception when trying to create Iceberg table if Hive table with same name already exists #10446

Closed
findinpath opened this issue Jan 3, 2022 · 0 comments · Fixed by #11539
Assignees
Labels
bug Something isn't working

Comments

@findinpath
Copy link
Contributor

findinpath commented Jan 3, 2022

create table hive.default.commontable (id bigint);
create table iceberg.default.commontable (id bigint);

The second query fails with the exception:

[2022-01-03 06:43:31] [84148224] Query failed (#20220103_054331_00040_cc26e): Not an Iceberg table: default.commontable

This message is rather misleading and should be changed with a meaningful message for the end user pointing out that a table with the same name and schema already exists in the hive metastore.

The issue occurs in io.trino.plugin.iceberg.catalog.AbstractMetastoreTableOperations#refresh method

 if (!isIcebergTable(table)) {
            throw new UnknownTableTypeException(getSchemaTableName());
}

However, due to the fact that the connectors hive and iceberg share the same hive metastore it is rather difficult to give a meaningful message in this case.

Executing the following statements

create table hive.default.commontable (id bigint);
create table hive.default.commontable (id bigint);

leads to the following error (as expected):

Query failed (#20220103_143437_00019_y848r): line 1:1: Table 'hive.default.commontable' already exists

Related issues:

#8693

@findinpath findinpath self-assigned this Jan 3, 2022
@findepi findepi added the bug Something isn't working label Jan 4, 2022
@findepi findepi changed the title Misleading exception when trying to create a table which already exists in the hive metastore Misleading exception when trying to create Iceberg table if Hive table with same name already exists Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants