From 879477e6e6d762c0efacfcca842ceed27ea15dcd Mon Sep 17 00:00:00 2001 From: tyrantlucifer Date: Thu, 15 Jun 2023 18:53:40 +0800 Subject: [PATCH] [Hotfix][Connector-V2][Hive] Support user-defined hive-site.xml --- .../connectors/seatunnel/hive/config/HiveConfig.java | 6 ++++++ .../connectors/seatunnel/hive/utils/HiveMetaStoreProxy.java | 3 +++ 2 files changed, 9 insertions(+) diff --git a/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/config/HiveConfig.java b/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/config/HiveConfig.java index 2d7f7cd9fb65..142863b5135e 100644 --- a/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/config/HiveConfig.java +++ b/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/config/HiveConfig.java @@ -37,6 +37,12 @@ public class HiveConfig { .stringType() .noDefaultValue() .withDescription("Hive metastore uri"); + + public static final Option HIVE_SITE_PATH = + Options.key("hive_site_path") + .stringType() + .noDefaultValue() + .withDescription("The path of hive-site.xml"); public static final String TEXT_INPUT_FORMAT_CLASSNAME = "org.apache.hadoop.mapred.TextInputFormat"; public static final String TEXT_OUTPUT_FORMAT_CLASSNAME = diff --git a/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreProxy.java b/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreProxy.java index f53384a41604..f6ba5cfb12cd 100644 --- a/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreProxy.java +++ b/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreProxy.java @@ -54,6 +54,9 @@ private HiveMetaStoreProxy(Config config) { Configuration configuration = new Configuration(); FileSystemUtils.doKerberosAuthentication(configuration, principal, keytabPath); } + if (config.hasPath(HiveConfig.HIVE_SITE_PATH.key())) { + hiveConf.addResource(config.getString(HiveConfig.HIVE_SITE_PATH.key())); + } try { hiveMetaStoreClient = new HiveMetaStoreClient(hiveConf); } catch (MetaException e) {