tsreaper commented on code in PR #764:
URL: https://github.com/apache/incubator-paimon/pull/764#discussion_r1152731838
##########
paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java:
##########
@@ -470,17 +472,53 @@ private Lock lock(Identifier identifier) {
return Lock.fromCatalog(lock, identifier);
}
+ private static final List<Class<?>[]> GET_PROXY_PARAMS =
+ Arrays.asList(
+ // for hive 2.x
+ new Class<?>[] {
+ HiveConf.class,
+ HiveMetaHookLoader.class,
+ ConcurrentHashMap.class,
+ String.class,
+ Boolean.TYPE
+ },
+ // for hive 3.x
+ new Class<?>[] {
+ Configuration.class,
+ HiveMetaHookLoader.class,
+ ConcurrentHashMap.class,
+ String.class,
+ Boolean.TYPE
+ });
+
static IMetaStoreClient createClient(HiveConf hiveConf, String
clientClassName) {
+ Method getProxy = null;
+ RuntimeException methodNotFound =
+ new RuntimeException(
+ "Failed to find desired getProxy method from
RetryingMetaStoreClient");
+ for (Class<?>[] classes : GET_PROXY_PARAMS) {
+ try {
+ getProxy = RetryingMetaStoreClient.class.getMethod("getProxy",
classes);
+ } catch (NoSuchMethodException e) {
+ methodNotFound.addSuppressed(e);
+ }
+ }
+ if (getProxy == null) {
+ throw methodNotFound;
+ }
+
IMetaStoreClient client;
try {
client =
- RetryingMetaStoreClient.getProxy(
- hiveConf,
- tbl -> null,
- new ConcurrentHashMap<>(),
- clientClassName,
- true);
- } catch (MetaException e) {
+ (IMetaStoreClient)
+ getProxy.invoke(
+ null,
+ hiveConf,
Review Comment:
The first parameter of `Method#invoke` is on which object you're calling
this method. As this is a static method, this parameter should be `null`.
Arguments for the original method starts from the second parameter.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]