diff --git a/docs/en/connector-v2/sink/Hive.md b/docs/en/connector-v2/sink/Hive.md index 5bcf80bd260..e97616fe735 100644 --- a/docs/en/connector-v2/sink/Hive.md +++ b/docs/en/connector-v2/sink/Hive.md @@ -36,6 +36,7 @@ By default, we use 2PC commit to ensure `exactly-once` | metastore_uri | string | yes | - | | compress_codec | string | no | none | | hdfs_site_path | string | no | - | +| hive_site_path | string | no | - | | kerberos_principal | string | no | - | | kerberos_keytab_path | string | no | - | | common-options | | no | - | @@ -52,6 +53,10 @@ Hive metastore uri The path of `hdfs-site.xml`, used to load ha configuration of namenodes +### hive_site_path [string] + +The path of `hive-site.xml`, used to authentication hive metastore + ### kerberos_principal [string] The principal of kerberos diff --git a/docs/en/connector-v2/source/Hive.md b/docs/en/connector-v2/source/Hive.md index 9b49b5929ce..f9f35aaf733 100644 --- a/docs/en/connector-v2/source/Hive.md +++ b/docs/en/connector-v2/source/Hive.md @@ -40,6 +40,7 @@ Read all the data in a split in a pollNext call. What splits are read will be sa | kerberos_principal | string | no | - | | kerberos_keytab_path | string | no | - | | hdfs_site_path | string | no | - | +| hive_site_path | string | no | - | | read_partitions | list | no | - | | read_columns | list | no | - | | common-options | | no | - | @@ -56,6 +57,10 @@ Hive metastore uri The path of `hdfs-site.xml`, used to load ha configuration of namenodes +### hive_site_path [string] + +The path of `hive-site.xml`, used to authentication hive metastore + ### read_partitions [list] The target partitions that user want to read from hive table, if user does not set this parameter, it will read all the data from hive table. 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 2d7f7cd9fb6..142863b5135 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 f53384a4160..f6ba5cfb12c 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) {