Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hotfix][Connector-V2][Hive] Support user-defined hive-site.xml #4965

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
TyrantLucifer marked this conversation as resolved.
Show resolved Hide resolved
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