You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "lishaoguang (Jira)" <ji...@apache.org> on 2023/12/09 12:27:00 UTC
[jira] [Comment Edited] (FLINK-33788) Table not found for catalogname is capital
[ https://issues.apache.org/jira/browse/FLINK-33788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17794949#comment-17794949 ]
lishaoguang edited comment on FLINK-33788 at 12/9/23 12:26 PM:
---------------------------------------------------------------
Hive will convert catalogname 'myHive' to lowercase 'myhive' when parsing, but the variable catalogs in CatalogManager is the catalogname you defined 'myHive' and the default catalog 'default_catalog', so it will report that the table cannot be found.
!image-2023-12-09-20-26-41-150.png!
was (Author: shaoguang):
Hive will convert catalogname 'myHive' to lowercase 'myhive' when parsing, but the variable catalogs in CatalogManager is the catalogname you defined 'myHive' and the default catalog 'default_catalog', so it will report that the table cannot be found.
!screenshot-2.png!
> Table not found for catalogname is capital
> ------------------------------------------
>
> Key: FLINK-33788
> URL: https://issues.apache.org/jira/browse/FLINK-33788
> Project: Flink
> Issue Type: Bug
> Affects Versions: 1.16.1
> Reporter: lishaoguang
> Priority: Major
> Attachments: image-2023-12-09-20-26-41-150.png, screenshot-2.png
>
>
> {code:java}
> String runMode=args[0];
> String sql = "select * from student";
> String sql = "insert into table student select * from student;";
> String sql = args[1];
> String catalogName = "myHive";
> String defaultDatabase = args[2];
> RuntimeExecutionMode executionMode = "batch".equals(runMode) ? RuntimeExecutionMode.BATCH : RuntimeExecutionMode.STREAMING;
> StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
> env.setRuntimeMode(executionMode);
> StreamTableEnvironment tenv = StreamTableEnvironment.create(env);
>
> tenv.getConfig().setSqlDialect(SqlDialect.HIVE);
> Configuration conf = new Configuration();
> conf.addResource("/ect/hadoop/conf");
> conf.addResource("/ect/hive/conf");
> HiveConf hiveConf = new HiveConf(conf, Configuration.class);
> String hiveVersion = "3.1.3";
> HiveCatalog hiveCatalog = new HiveCatalog(catalogName, defaultDatabase, hiveConf, hiveVersion, true);
> tenv.registerCatalog(catalogName, hiveCatalog);
> tenv.useCatalog(catalogName);
> tenv.useDatabase(defaultDatabase);
> tenv.executeSql(sql).print(); {code}
> Even if the table exists in hive, the query will still report an error like"Caused by: org.apache.hadoop.hive.ql.parse.SemanticException: Line 1:14 Table not found 'student'"
--
This message was sent by Atlassian Jira
(v8.20.10#820010)