This is an automated email from the ASF dual-hosted git repository.
gaojun2048 pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new 2a064bcdb0 [Hotfix][Connector-V2][Hive] Support user-defined
hive-site.xml (#4965)
2a064bcdb0 is described below
commit 2a064bcdb0c5c235d8ebd1f1f9b83d974792082f
Author: Tyrantlucifer <[email protected]>
AuthorDate: Mon Jul 3 12:03:54 2023 +0800
[Hotfix][Connector-V2][Hive] Support user-defined hive-site.xml (#4965)
---
docs/en/connector-v2/sink/Hive.md | 5 +++++
docs/en/connector-v2/source/Hive.md | 5 +++++
.../seatunnel/connectors/seatunnel/hive/config/HiveConfig.java | 6 ++++++
.../connectors/seatunnel/hive/utils/HiveMetaStoreProxy.java | 3 +++
4 files changed, 19 insertions(+)
diff --git a/docs/en/connector-v2/sink/Hive.md
b/docs/en/connector-v2/sink/Hive.md
index 5bcf80bd26..e97616fe73 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 9b49b5929c..f9f35aaf73 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 2d7f7cd9fb..142863b513 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<String> 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 f53384a416..f6ba5cfb12 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 @@ public class HiveMetaStoreProxy {
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) {