[ 
https://issues.apache.org/jira/browse/FLINK-33788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17795137#comment-17795137
 ] 

luoyuxia commented on FLINK-33788:
----------------------------------

[~shaoguang] Thanks for reporting it. As Hive is case-insentive, when using 
Hive dialect, we'll always convert table name, database name, catalog name to 
lowercase. But it seems we shouldn't convert catalog name to lowercase 
directly, otherwise, it won't find the catalog reigsterd in flink. I think it's 
a bug that should be fixed. Could you please help fix if you're free? I think 
1.17, 1.18, master should be fixed.

But for master, you should submit a pr in a dedicated repo for Hive. 
https://github.com/apache/flink-connector-hive

> 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-1.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)

Reply via email to