You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/10/26 13:37:29 UTC

[GitHub] [iceberg] zhangminglei commented on a change in pull request #1659: Flink: load hive-site.xml for HiveCatalog from system env.

zhangminglei commented on a change in pull request #1659:
URL: https://github.com/apache/iceberg/pull/1659#discussion_r511964458



##########
File path: flink/src/main/java/org/apache/iceberg/flink/FlinkCatalogFactory.java
##########
@@ -144,6 +144,11 @@ private static Configuration mergeHiveConf(Configuration hadoopConf, String hive
       URL configFile = CatalogLoader.class.getClassLoader().getResource("hive-site.xml");
       if (configFile != null) {
         newConf.addResource(configFile);
+      } else {
+        // If can not find hive-site.xml from classpath, then try to load resource from system env.
+        // this would be useful if don't set `hive-conf-dir` key in ddl.
+        String hiveHome = System.getenv("HIVE_HOME");
+        newConf.addResource(new Path(hiveHome + "/conf/hive-site.xml"));

Review comment:
       Maybe we do not need a unit tests for this, since we use system environment to get `HIVE_HOME`. But we don't have a method called `System.setEnv` and then get it. I found a method to set in https://github.com/stefanbirkner/system-lambda, but it may be too complex. 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org