aturoczy commented on code in PR #5628: URL: https://github.com/apache/hive/pull/5628#discussion_r2074968626
########## ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java: ########## @@ -6006,12 +6009,7 @@ public HiveMetaHook getHook( } }; - if (conf.getBoolVar(ConfVars.METASTORE_FASTPATH)) { - return new SessionHiveMetaStoreClient(conf, hookLoader, allowEmbedded); - } else { - return RetryingMetaStoreClient.getProxy(conf, hookLoader, metaCallTimeMap, - SessionHiveMetaStoreClient.class.getName(), allowEmbedded); - } + return IMetaStoreClientFactory.create(conf,allowEmbedded, metaCallTimeMap,hookLoader); Review Comment: Just hurt my eyes :) after conf the , there is no space. I know, I know. ¯\_(ツ)_/¯ ########## ql/src/java/org/apache/hadoop/hive/ql/metadata/IMetaStoreClientFactory.java: ########## @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hive.ql.metadata; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.metastore.HiveMetaHookLoader; +import org.apache.hadoop.hive.metastore.IMetaStoreClient; +import org.apache.hadoop.hive.metastore.RetryingMetaStoreClient; +import org.apache.hadoop.hive.metastore.api.MetaException; +import org.apache.hadoop.hive.metastore.utils.JavaUtils; +import org.apache.hadoop.hive.ql.exec.Utilities; + +import java.util.concurrent.ConcurrentHashMap; + +public class IMetaStoreClientFactory { + public static IMetaStoreClient create(HiveConf hiveConf, boolean allowEmbedded, + ConcurrentHashMap<String, Long> metaCallTimeMap, HiveMetaHookLoader hookLoader) throws MetaException { + + if ("rest".equals(hiveConf.get("metastore.type", "hms"))) { + return getHiveIcebergRESTCatalog(hiveConf, hookLoader); + } + + if (hiveConf.getBoolVar(HiveConf.ConfVars.METASTORE_FASTPATH)) { + return new SessionHiveMetaStoreClient(hiveConf, hookLoader, allowEmbedded); + } else { + return RetryingMetaStoreClient.getProxy(hiveConf, hookLoader, metaCallTimeMap, + SessionHiveMetaStoreClient.class.getName(), allowEmbedded); + } + } + private static IMetaStoreClient getHiveIcebergRESTCatalog(HiveConf conf, HiveMetaHookLoader hookLoader) throws + MetaException { + try { + Class<? extends IMetaStoreClient> handlerClass = Review Comment: Why do you need reflection here? Is it not simpler just to inject the implementation? -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org