[
https://issues.apache.org/jira/browse/FLINK-33788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17795152#comment-17795152
]
luoyuxia edited comment on FLINK-33788 at 12/11/23 3:42 AM:
------------------------------------------------------------
[~shaoguang] Cool! Thanks. One hint is that we may only need to consider the
caller of
{code:java}
String getUnescapedName(
HiveParserASTNode tableOrColumnNode,
@Nullable String currentCatalog,
@Nullable String currentDatabase) {
xx
} {code}
Since it's the only entrypoint to pass catalog. For database name and table
name, it's safe and a must to convert it to lowercase since Hive is
case-insentive. But we shouldn't convert catalog name to lowercase.
was (Author: luoyuxia):
[~shaoguang] Cool! Thanks. One hint is that we may only need to consider the
caller of
{code:java}
String getUnescapedName(
HiveParserASTNode tableOrColumnNode,
@Nullable String currentCatalog,
@Nullable String currentDatabase) {
xx
} {code}
Since it's the only entrypoint to pass catalog. For database name and table
name, it's safe and a must to convert it to lowercase since Hive is
case-insentive. But we shouldn't convert catalog name to lowercase.
> 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)