apache / iceberg

Apache Iceberg
https://iceberg.apache.org/
Apache License 2.0
6.4k stars 2.21k forks source link

Listing tables will crash the flink sql client after creating a new hadoop catalog #1434

Closed openinx closed 4 years ago

openinx commented 4 years ago

When I test the flink-runtime module from this pull request https://github.com/apache/iceberg/pull/1423/files , I got this crash stacktrace.

Flink SQL> create catalog hadoop_catalog with(
>   'type'='iceberg',
>   'catalog-type'='hadoop',
>   'warehouse'='file:///Users/openinx/Downloads',
>   'property-version'='1'
> );
[INFO] Catalog has been created.

Flink SQL> use catalog hadoop_catalog; 

Flink SQL> show tables; 

Exception in thread "main" org.apache.flink.table.client.SqlClientException: Unexpected exception. This is a bug. Please consider filing an issue.
    at org.apache.flink.table.client.SqlClient.main(SqlClient.java:213)
Caused by: org.apache.flink.table.api.ValidationException: Current database does not exist
    at org.apache.flink.table.catalog.CatalogManager.listTables(CatalogManager.java:451)
    at org.apache.flink.table.catalog.CatalogManager.listTables(CatalogManager.java:433)
    at org.apache.flink.table.api.internal.TableEnvironmentImpl.listTables(TableEnvironmentImpl.java:560)
    at org.apache.flink.table.client.gateway.local.LocalExecutor.lambda$listTables$5(LocalExecutor.java:345)
    at org.apache.flink.table.client.gateway.local.ExecutionContext.wrapClassLoader(ExecutionContext.java:255)
    at org.apache.flink.table.client.gateway.local.LocalExecutor.listTables(LocalExecutor.java:345)
    at org.apache.flink.table.client.cli.CliClient.callShowTables(CliClient.java:460)
    at org.apache.flink.table.client.cli.CliClient.callCommand(CliClient.java:289)
    at java.util.Optional.ifPresent(Optional.java:159)
    at org.apache.flink.table.client.cli.CliClient.open(CliClient.java:212)
    at org.apache.flink.table.client.SqlClient.openCli(SqlClient.java:142)
    at org.apache.flink.table.client.SqlClient.start(SqlClient.java:114)
    at org.apache.flink.table.client.SqlClient.main(SqlClient.java:201)
Caused by: org.apache.flink.table.catalog.exceptions.DatabaseNotExistException: Database default does not exist in Catalog hadoop_catalog.
    at org.apache.iceberg.flink.FlinkCatalog.listTables(FlinkCatalog.java:287)
    at org.apache.flink.table.catalog.CatalogManager.listTables(CatalogManager.java:447)
    ... 12 more
Caused by: org.apache.iceberg.exceptions.NoSuchNamespaceException: Namespace does not exist: default
    at org.apache.iceberg.hadoop.HadoopCatalog.listTables(HadoopCatalog.java:132)
    at org.apache.iceberg.CachingCatalog.listTables(CachingCatalog.java:61)
    at org.apache.iceberg.flink.FlinkCatalog.listTables(FlinkCatalog.java:283)
    ... 13 more

Shutting down the session...
done.
openinx commented 4 years ago

The patch #1435 fixed the crash issue, here is the verification.

Flink SQL> create catalog hadoop_catalog with(
>   'type'='iceberg',
>   'catalog-type'='hadoop',
>   'warehouse'='file:///Users/openinx/Downloads',
>   'property-version'='1'
> );
[INFO] Catalog has been created.

Flink SQL> use catalog hadoop_catalog;

Flink SQL> show tables; 
[INFO] Result was empty.

Flink SQL> show databases; 
default