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/01 20:40:03 UTC

[GitHub] [iceberg] kbendick commented on a change in pull request #1527: load hive-site.xml for flink catalog

kbendick commented on a change in pull request #1527:
URL: https://github.com/apache/iceberg/pull/1527#discussion_r498500973



##########
File path: flink/src/main/java/org/apache/iceberg/flink/FlinkCatalogFactory.java
##########
@@ -121,4 +135,36 @@ protected Catalog createCatalog(String name, Map<String, String> properties, Con
   public static Configuration clusterHadoopConf() {
     return HadoopUtils.getHadoopConfiguration(GlobalConfiguration.loadConfiguration());
   }
+
+  private void loadHiveConf(Configuration configuration, Map<String, String> properties) {
+    String hiveConfPath = properties.get(HIVE_SITE_PATH);
+    Path path = new Path(hiveConfPath);
+    if (hiveConfPath.startsWith("hdfs")) {
+      download(configuration, path);
+    } else {
+      File file = new File(hiveConfPath);
+      if (!file.exists()) {
+        LOGGER.error("{} doesn't exist. if in application mode ," +
+                " please provide a hdfs path for hive-site.xml", hiveConfPath);
+      } else {
+        configuration.addResource(path);
+      }
+    }
+  }
+
+  private void download(Configuration configuration, Path hdfsHiveSitePath) {
+    try {
+      File tmpFile = File.createTempFile("hive-site.xml-", "");

Review comment:
       That sounds much better to me. `.tmp` definitely better conveys the intent to me. Thanks for updating that!




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