[ https://issues.apache.org/jira/browse/FLINK-28913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17578226#comment-17578226 ]
luoyuxia edited comment on FLINK-28913 at 8/11/22 3:32 AM: ----------------------------------------------------------- The workaround way is to swap `opt/flink-table-planner` and `lib/flink-table-planner-loader` as flink-table-planner contains calcite dependency. But to fix it, I think we can lazy init the `Hive` class, only when we need to call method `loadTable` / `loadPartition`. I think it's fine for only in Hive dialect, do we need `Hive` class, and when user want to use Hive dialect, they need to swap `lib/flink-table-planner-loader` and `opt/flink-table-planner` so that the calcite will exist in class path. was (Author: luoyuxia): The workaround way is to swap `opt/flink-table-planner` and `lib/flink-table-planner-loader` as flink-table-planner contains calcite dependency. But to fix it, I think we can lazy init the `Hive`, only when we need to call method `loadTable` / `loadPartition`. I think it's fine for only in Hive dialect, do we need `Hive`, and when user want to use Hive dialect, they need to swap `lib/flink-table-planner-loader` and `opt/flink-table-planner` so that the calcite will exist in class path. > Fix fail to open HiveCatalog when it's for hive3 > ------------------------------------------------ > > Key: FLINK-28913 > URL: https://issues.apache.org/jira/browse/FLINK-28913 > Project: Flink > Issue Type: Bug > Components: Connectors / Hive > Reporter: luoyuxia > Priority: Critical > Fix For: 1.16.0 > > > When use HiveCatalog for hive3, it will throw such exception: > {code:java} > java.lang.NoClassDefFoundError: org/apache/calcite/plan/RelOptRule > at > org.apache.flink.table.catalog.hive.client.HiveMetastoreClientWrapper.<init>(HiveMetastoreClientWrapper.java:91) > at > org.apache.flink.table.catalog.hive.client.HiveMetastoreClientWrapper.<init>(HiveMetastoreClientWrapper.java:79) > at > org.apache.flink.table.catalog.hive.client.HiveMetastoreClientFactory.create(HiveMetastoreClientFactory.java:32) > at > org.apache.flink.table.catalog.hive.HiveCatalog.open(HiveCatalog.java:306) > at > org.apache.flink.table.catalog.CatalogManager.registerCatalog(CatalogManager.java:211) > at > org.apache.flink.table.api.internal.TableEnvironmentImpl.registerCatalog(TableEnvironmentImpl.java:382) > {code} > The failure is introduced by > [FLINK-26413|https://issues.apache.org/jira/browse/FLINK-26413], which > introduces `Hive.get(hiveConf);` in method > `HiveMetastoreClientFactory.create` to support Hive's "load data inpath` > syntax. > But the class `Hive` will import class 'org.apache.calcite.plan.RelOptRule', > then when try to load the class `Hive`, it'll throw class not found exception > since this class is not in class path. -- This message was sent by Atlassian Jira (v8.20.10#820010)