Skip to content

Commit

Permalink
[Hotfix][Connector-V2][Hive] Support user-defined hive-site.xml (apac…
Browse files Browse the repository at this point in the history
  • Loading branch information
TyrantLucifer authored and EricJoy2048 committed Jul 3, 2023
1 parent 16ae34a commit 50f9aa8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/en/connector-v2/sink/Hive.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | - |
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions docs/en/connector-v2/source/Hive.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | - |
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 50f9aa8

Please sign in to comment.