From 757f96abf67369e1ec30834c6bbefea4e0b40546 Mon Sep 17 00:00:00 2001 From: zhuangchong Date: Tue, 3 Dec 2024 21:02:15 +0800 Subject: [PATCH] Add metastore.client.class option to hive catalog configuration document. --- .../generated/hive_catalog_configuration.html | 7 +++++++ .../main/java/org/apache/paimon/hive/HiveCatalog.java | 2 +- .../org/apache/paimon/hive/HiveCatalogFactory.java | 11 ----------- .../org/apache/paimon/hive/HiveCatalogOptions.java | 9 +++++++++ .../paimon/iceberg/IcebergHiveMetadataCommitter.java | 4 ++-- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/layouts/shortcodes/generated/hive_catalog_configuration.html b/docs/layouts/shortcodes/generated/hive_catalog_configuration.html index e0257d301b6f..7b6242616f35 100644 --- a/docs/layouts/shortcodes/generated/hive_catalog_configuration.html +++ b/docs/layouts/shortcodes/generated/hive_catalog_configuration.html @@ -65,5 +65,12 @@ you can set this option to true. + +
metastore.client.class
+ "org.apache.hadoop.hive.metastore.HiveMetaStoreClient" + String + Class name of Hive metastore client. +NOTE: This class must directly implements org.apache.hadoop.hive.metastore.IMetaStoreClient. + diff --git a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java index 5157e606006c..151e2b4d2c07 100644 --- a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java +++ b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java @@ -1349,7 +1349,7 @@ public static Catalog createHiveCatalog(CatalogContext context) { return new HiveCatalog( fileIO, hiveConf, - options.get(HiveCatalogFactory.METASTORE_CLIENT_CLASS), + options.get(HiveCatalogOptions.METASTORE_CLIENT_CLASS), options, warehouse.toUri().toString()); } diff --git a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalogFactory.java b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalogFactory.java index 95da0037168c..eff06831dd4f 100644 --- a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalogFactory.java +++ b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalogFactory.java @@ -21,23 +21,12 @@ import org.apache.paimon.catalog.Catalog; import org.apache.paimon.catalog.CatalogContext; import org.apache.paimon.catalog.CatalogFactory; -import org.apache.paimon.options.ConfigOption; -import org.apache.paimon.options.ConfigOptions; import static org.apache.paimon.hive.HiveCatalogOptions.IDENTIFIER; /** Factory to create {@link HiveCatalog}. */ public class HiveCatalogFactory implements CatalogFactory { - public static final ConfigOption METASTORE_CLIENT_CLASS = - ConfigOptions.key("metastore.client.class") - .stringType() - .defaultValue("org.apache.hadoop.hive.metastore.HiveMetaStoreClient") - .withDescription( - "Class name of Hive metastore client.\n" - + "NOTE: This class must directly implements " - + "org.apache.hadoop.hive.metastore.IMetaStoreClient."); - @Override public String identifier() { return IDENTIFIER; diff --git a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalogOptions.java b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalogOptions.java index 38f73bc6bd65..ceab49836820 100644 --- a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalogOptions.java +++ b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalogOptions.java @@ -48,6 +48,15 @@ public final class HiveCatalogOptions { + "If not configured, try to load from 'HADOOP_CONF_DIR' or 'HADOOP_HOME' system environment.\n" + "Configure Priority: 1.from 'hadoop-conf-dir' 2.from HADOOP_CONF_DIR 3.from HADOOP_HOME/conf 4.HADOOP_HOME/etc/hadoop.\n"); + public static final ConfigOption METASTORE_CLIENT_CLASS = + ConfigOptions.key("metastore.client.class") + .stringType() + .defaultValue("org.apache.hadoop.hive.metastore.HiveMetaStoreClient") + .withDescription( + "Class name of Hive metastore client.\n" + + "NOTE: This class must directly implements " + + "org.apache.hadoop.hive.metastore.IMetaStoreClient."); + public static final ConfigOption LOCATION_IN_PROPERTIES = ConfigOptions.key("location-in-properties") .booleanType() diff --git a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/iceberg/IcebergHiveMetadataCommitter.java b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/iceberg/IcebergHiveMetadataCommitter.java index d913f729e351..6d2e11583c7a 100644 --- a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/iceberg/IcebergHiveMetadataCommitter.java +++ b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/iceberg/IcebergHiveMetadataCommitter.java @@ -22,7 +22,7 @@ import org.apache.paimon.client.ClientPool; import org.apache.paimon.fs.Path; import org.apache.paimon.hive.HiveCatalog; -import org.apache.paimon.hive.HiveCatalogFactory; +import org.apache.paimon.hive.HiveCatalogOptions; import org.apache.paimon.hive.HiveTypeUtils; import org.apache.paimon.hive.pool.CachedClientPool; import org.apache.paimon.options.Options; @@ -100,7 +100,7 @@ public IcebergHiveMetadataCommitter(FileStoreTable table) { new CachedClientPool( hiveConf, options, - HiveCatalogFactory.METASTORE_CLIENT_CLASS.defaultValue()); + HiveCatalogOptions.METASTORE_CLIENT_CLASS.defaultValue()); } @Override