[
https://issues.apache.org/jira/browse/FLINK-13150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16882587#comment-16882587
]
Jeff Zhang commented on FLINK-13150:
------------------------------------
[~xuefuz] It happens when I register table. here's the sample code to reproduce
this issue. The root cause is that it seems when I call tEnv.useCatalog, the
defaultCatalogName in TableEnvImpl is not changed, so that when I do register
table, it still register to
GenericInMemoryCatalog instead of HiveCatalog.
{code:java}
// set up execution environment
val env = ExecutionEnvironment.getExecutionEnvironment
val tEnv = BatchTableEnvironment.create(env)
val hiveCatalog = new HiveCatalog("hive", "default",
"/Users/jzhang/Java/lib/apache-hive-2.3.4-bin/conf", "2.3.4");
tEnv.registerCatalog("hive", hiveCatalog)
tEnv.useCatalog("hive")
val input = env.fromElements(WC("hello", 1), WC("hello", 1), WC("ciao", 1))
// register the DataSet as table "WordCount"
tEnv.registerDataSet("WordCount", input, 'word, 'frequency)
// run a SQL query on the Table and retrieve the result as a new Table
val table = tEnv.sqlQuery("SELECT word, SUM(frequency) FROM WordCount GROUP BY
word")
table.toDataSet[WC].print(){code}
> defaultCatalogName and defaultDatabaseName in TableEnvImpl is not updated
> after they are updated in TableEnvironment
> --------------------------------------------------------------------------------------------------------------------
>
> Key: FLINK-13150
> URL: https://issues.apache.org/jira/browse/FLINK-13150
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / API
> Affects Versions: 1.9.0
> Reporter: Jeff Zhang
> Assignee: Xuefu Zhang
> Priority: Major
>
> defaultCatalogName and defaultDatabaseName in TableEnvImpl are initialized
> when it is created and never changed even when they are updated in
> TableEnvironment.
> The will cause issues that we may register table to the wrong catalog after
> we changed the defaultCatalogName and defaultDatabaseName
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)