You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/11/04 02:57:28 UTC

[GitHub] [hudi] zhedoubushishi commented on a change in pull request #3416: [HUDI-2362] Add external config file support

zhedoubushishi commented on a change in pull request #3416:
URL: https://github.com/apache/hudi/pull/3416#discussion_r742502013



##########
File path: hudi-common/src/main/java/org/apache/hudi/common/config/DFSPropertiesConfiguration.java
##########
@@ -117,7 +137,49 @@ public void addProperties(BufferedReader reader) throws IOException {
     }
   }
 
+  public static TypedProperties getGlobalConfig() {
+    final TypedProperties globalProps = new TypedProperties();
+    globalProps.putAll(HUDI_CONF_PROPS);
+    return globalProps;
+  }
+
   public TypedProperties getConfig() {
-    return props;
+    return getConfig(false);
+  }
+
+  public TypedProperties getConfig(Boolean includeHudiConf) {
+    if (includeHudiConf) {
+      TypedProperties mergedProps = new TypedProperties();
+      mergedProps.putAll(HUDI_CONF_PROPS);
+      mergedProps.putAll(props);
+      return mergedProps;
+    } else {
+      return props;
+    }
+  }
+
+  private static Path getDefaultConfPath() {
+    String confDir = System.getenv(CONF_FILE_DIR_ENV_NAME);
+    if (confDir == null) {
+      LOG.warn("Cannot find " + CONF_FILE_DIR_ENV_NAME + ", please set it as the dir of " + DEFAULT_PROPERTIES_FILE);
+      return null;
+    }
+    return new Path("file://" + confDir + File.separator + DEFAULT_PROPERTIES_FILE);
+  }
+
+  private String[] splitProperty(String line) {
+    line = line.replaceAll("\\s+"," ");
+    String delimiter = line.contains("=") ? "=" : " ";
+    int ind = line.indexOf(delimiter);
+    String k = line.substring(0, ind).trim();
+    String v = line.substring(ind + 1).trim();
+    return new String[] {k, v};
+  }
+
+  private boolean isValidLine(String line) {
+    if (line.startsWith("#") || line.equals("")) {

Review comment:
       Done




-- 
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: commits-unsubscribe@hudi.apache.org

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