yuqi1129 commented on code in PR #6923:
URL: https://github.com/apache/gravitino/pull/6923#discussion_r2053700859
##########
catalogs/catalog-lakehouse-hudi/src/main/java/org/apache/gravitino/catalog/lakehouse/hudi/backend/hms/HudiHMSBackendOps.java:
##########
@@ -236,12 +249,30 @@ private HiveConf buildHiveConf(Map<String, String>
properties) {
byPassConfigs.put(key.substring(CATALOG_BYPASS_PREFIX.length()),
value);
} else if (CONFIG_CONVERTER.containsKey(key)) {
convertedConfigs.put(CONFIG_CONVERTER.get(key), value);
+ } else {
+ hadoopConf.set(key, value);
}
});
byPassConfigs.forEach(hadoopConf::set);
- // Gravitino conf has higher priority than bypass conf
convertedConfigs.forEach(hadoopConf::set);
-
+ initKerberosAuth(properties, hadoopConf);
return new HiveConf(hadoopConf, HudiHMSBackendOps.class);
}
+
+ private void initKerberosAuth(Map<String, String> properties, Configuration
hadoopConf) {
+ AuthenticationConfig authenticationConfig = new
AuthenticationConfig(properties);
+ if (authenticationConfig.isKerberosAuth()) {
+ try (KerberosClient kerberosClient = new KerberosClient(properties,
hadoopConf, true)) {
+ String keytabPath =
+ String.format(
+ GRAVITINO_KEYTAB_FORMAT, Objects.isNull(this.info) ? "0" :
this.info.id());
+ File keytabFile = kerberosClient.saveKeyTabFileFromUri(keytabPath);
+ kerberosClient.login(keytabFile.getAbsolutePath());
+ LOG.info("Login with kerberos success");
+ return;
Review Comment:
unnecessary return
##########
catalogs/catalog-lakehouse-hudi/src/main/java/org/apache/gravitino/catalog/lakehouse/hudi/backend/hms/HudiHMSBackendOps.java:
##########
@@ -236,12 +249,30 @@ private HiveConf buildHiveConf(Map<String, String>
properties) {
byPassConfigs.put(key.substring(CATALOG_BYPASS_PREFIX.length()),
value);
} else if (CONFIG_CONVERTER.containsKey(key)) {
convertedConfigs.put(CONFIG_CONVERTER.get(key), value);
+ } else {
+ hadoopConf.set(key, value);
}
});
byPassConfigs.forEach(hadoopConf::set);
- // Gravitino conf has higher priority than bypass conf
convertedConfigs.forEach(hadoopConf::set);
-
+ initKerberosAuth(properties, hadoopConf);
return new HiveConf(hadoopConf, HudiHMSBackendOps.class);
}
+
+ private void initKerberosAuth(Map<String, String> properties, Configuration
hadoopConf) {
+ AuthenticationConfig authenticationConfig = new
AuthenticationConfig(properties);
+ if (authenticationConfig.isKerberosAuth()) {
+ try (KerberosClient kerberosClient = new KerberosClient(properties,
hadoopConf, true)) {
+ String keytabPath =
+ String.format(
+ GRAVITINO_KEYTAB_FORMAT, Objects.isNull(this.info) ? "0" :
this.info.id());
+ File keytabFile = kerberosClient.saveKeyTabFileFromUri(keytabPath);
+ kerberosClient.login(keytabFile.getAbsolutePath());
+ LOG.info("Login with kerberos success");
+ return;
+ } catch (java.io.IOException e) {
Review Comment:
java.io.IOException -> IOException
##########
catalogs/catalog-lakehouse-hudi/src/main/java/org/apache/gravitino/catalog/lakehouse/hudi/backend/hms/HudiHMSBackendOps.java:
##########
@@ -236,12 +249,30 @@ private HiveConf buildHiveConf(Map<String, String>
properties) {
byPassConfigs.put(key.substring(CATALOG_BYPASS_PREFIX.length()),
value);
} else if (CONFIG_CONVERTER.containsKey(key)) {
convertedConfigs.put(CONFIG_CONVERTER.get(key), value);
+ } else {
+ hadoopConf.set(key, value);
}
});
byPassConfigs.forEach(hadoopConf::set);
- // Gravitino conf has higher priority than bypass conf
convertedConfigs.forEach(hadoopConf::set);
-
+ initKerberosAuth(properties, hadoopConf);
return new HiveConf(hadoopConf, HudiHMSBackendOps.class);
}
+
+ private void initKerberosAuth(Map<String, String> properties, Configuration
hadoopConf) {
+ AuthenticationConfig authenticationConfig = new
AuthenticationConfig(properties);
+ if (authenticationConfig.isKerberosAuth()) {
+ try (KerberosClient kerberosClient = new KerberosClient(properties,
hadoopConf, true)) {
+ String keytabPath =
+ String.format(
+ GRAVITINO_KEYTAB_FORMAT, Objects.isNull(this.info) ? "0" :
this.info.id());
Review Comment:
Have you only used the value `id` in `CatalogInfo`? If so, I suggest you put
the id in the property map and do not change the interface signature.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]