[ https://issues.apache.org/jira/browse/FLINK-13279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16888732#comment-16888732 ]
Timo Walther edited comment on FLINK-13279 at 7/19/19 9:20 AM: --------------------------------------------------------------- Hi [~xuefuz], thanks for your valuable feedback. Your concerns are valid. [~dawidwys]'s PR makes the API more user-friendly but we are also messing up the lookup design here. I think the root cause of this discussion is that we don't have a proper separation between tables that need to be persisted in a catalog and temporary tables that are only available in the current session. I did some research for future discussions: MySQL: https://dev.mysql.com/doc/refman/8.0/en/create-temporary-table.html {code} TEMPORARY tables have a very loose relationship with databases (schemas). Dropping a database does not automatically drop any TEMPORARY tables created within that database. Also, you can create a TEMPORARY table in a nonexistent database if you qualify the table name with the database name in the CREATE TABLE statement. In this case, all subsequent references to the table must be qualified with the database name. {code} SQL Server: https://docs.microsoft.com/de-de/sql/relational-databases/databases/tempdb-database?view=sql-server-2017 {code} Tempdb is used to hold: Temporary user objects that are explicitly created, such as: global or local temporary tables {code} We have two options: either we force users to fully specify the path or maintain a separate Map as MySQL does it. I think we can avoid the exception of this JIRA ticket easily by changing the SQL Client {{insertInto}} statement to a fully qualified one and stick to the current behavior for now. was (Author: twalthr): Hi [~xuefuz], thanks for your valuable feedback. Your concerns are valid. [~dawidwys]'s PR makes the API more user-friendly but we are also messing up the lookup design here. I think the root cause of this discussion is that we don't have a proper separation between tables that need to be persisted in a catalog and temporary tables that are only available in the current session. I did some research for future discussions: MySQL: https://dev.mysql.com/doc/refman/8.0/en/create-temporary-table.html {code} TEMPORARY tables have a very loose relationship with databases (schemas). Dropping a database does not automatically drop any TEMPORARY tables created within that database. Also, you can create a TEMPORARY table in a nonexistent database if you qualify the table name with the database name in the CREATE TABLE statement. In this case, all subsequent references to the table must be qualified with the database name. {code} https://docs.microsoft.com/de-de/sql/relational-databases/databases/tempdb-database?view=sql-server-2017 {code} Tempdb is used to hold: Temporary user objects that are explicitly created, such as: global or local temporary tables {code} We have two options: either we force users to fully specify the path or maintain a separate Map as MySQL does it. I think we can avoid the exception of this JIRA ticket easily by changing the SQL Client {{insertInto}} statement to a fully qualified one and stick to the current behavior for now. > not able to query table registered in catalogs in SQL CLI > --------------------------------------------------------- > > Key: FLINK-13279 > URL: https://issues.apache.org/jira/browse/FLINK-13279 > Project: Flink > Issue Type: Bug > Components: Table SQL / API, Table SQL / Client, Table SQL / Legacy > Planner, Table SQL / Planner > Affects Versions: 1.9.0 > Reporter: Bowen Li > Assignee: Dawid Wysakowicz > Priority: Blocker > Labels: pull-request-available > Fix For: 1.9.0 > > Time Spent: 10m > Remaining Estimate: 0h > > When querying a simple table in catalog, SQL CLI reports > "org.apache.flink.table.api.TableException: No table was registered under the > name ArrayBuffer(default: select * from hivetable)." > [~ykt836] can you please help to triage this ticket to proper person? > Repro steps in SQL CLI (to set up dependencies of HiveCatalog, please refer > to dev/table/catalog.md): > {code:java} > Flink SQL> show catalogs; > default_catalog > myhive > Flink SQL> use catalog myhive > > ; > Flink SQL> show databases; > default > Flink SQL> show tables; > hivetable > products > test > Flink SQL> describe hivetable; > root > |-- name: STRING > |-- score: DOUBLE > Flink SQL> select * from hivetable; > [ERROR] Could not execute SQL statement. Reason: > org.apache.flink.table.api.TableException: No table was registered under the > name ArrayBuffer(default: select * from hivetable). > {code} > Exception in log: > {code:java} > 2019-07-15 14:59:12,273 WARN org.apache.flink.table.client.cli.CliClient > - Could not execute SQL statement. > org.apache.flink.table.client.gateway.SqlExecutionException: Invalid SQL > query. > at > org.apache.flink.table.client.gateway.local.LocalExecutor.executeQueryInternal(LocalExecutor.java:485) > at > org.apache.flink.table.client.gateway.local.LocalExecutor.executeQuery(LocalExecutor.java:317) > at > org.apache.flink.table.client.cli.CliClient.callSelect(CliClient.java:469) > at > org.apache.flink.table.client.cli.CliClient.callCommand(CliClient.java:291) > at java.util.Optional.ifPresent(Optional.java:159) > at org.apache.flink.table.client.cli.CliClient.open(CliClient.java:200) > at org.apache.flink.table.client.SqlClient.openCli(SqlClient.java:123) > at org.apache.flink.table.client.SqlClient.start(SqlClient.java:105) > at org.apache.flink.table.client.SqlClient.main(SqlClient.java:194) > Caused by: org.apache.flink.table.api.TableException: No table was registered > under the name ArrayBuffer(default: select * from hivetable). > at > org.apache.flink.table.api.internal.TableEnvImpl.insertInto(TableEnvImpl.scala:529) > at > org.apache.flink.table.api.internal.TableEnvImpl.insertInto(TableEnvImpl.scala:507) > at > org.apache.flink.table.api.internal.BatchTableEnvImpl.insertInto(BatchTableEnvImpl.scala:58) > at > org.apache.flink.table.api.internal.TableImpl.insertInto(TableImpl.java:428) > at > org.apache.flink.table.api.internal.TableImpl.insertInto(TableImpl.java:416) > at > org.apache.flink.table.client.gateway.local.LocalExecutor.lambda$executeQueryInternal$10(LocalExecutor.java:476) > at > org.apache.flink.table.client.gateway.local.ExecutionContext.wrapClassLoader(ExecutionContext.java:202) > at > org.apache.flink.table.client.gateway.local.LocalExecutor.executeQueryInternal(LocalExecutor.java:474) > ... 8 more > {code} > However, {{select * from myhive.`default`.hivetable;}} seems to work well > Also note this is tested with changes in > https://github.com/apache/flink/pull/9049 -- This message was sent by Atlassian JIRA (v7.6.14#76016)