You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by na...@apache.org on 2019/05/09 00:30:28 UTC

[incubator-hudi] branch master updated: Don't raise when spark-defaults.conf doesn't exist

This is an automated email from the ASF dual-hosted git repository.

nagarwal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b27cc7  Don't raise when spark-defaults.conf doesn't exist
4b27cc7 is described below

commit 4b27cc72bbb87b74c47950a2bd24ef94cfecac8d
Author: David Muto (pseudomuto) <da...@gmail.com>
AuthorDate: Tue May 7 21:16:58 2019 -0400

    Don't raise when spark-defaults.conf doesn't exist
---
 .../src/main/java/com/uber/hoodie/cli/utils/SparkUtil.java    | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/hoodie-cli/src/main/java/com/uber/hoodie/cli/utils/SparkUtil.java b/hoodie-cli/src/main/java/com/uber/hoodie/cli/utils/SparkUtil.java
index 2dd446b..3f132de 100644
--- a/hoodie-cli/src/main/java/com/uber/hoodie/cli/utils/SparkUtil.java
+++ b/hoodie-cli/src/main/java/com/uber/hoodie/cli/utils/SparkUtil.java
@@ -21,6 +21,8 @@ import com.uber.hoodie.cli.commands.SparkMain;
 import com.uber.hoodie.common.util.FSUtils;
 import java.io.File;
 import java.net.URISyntaxException;
+
+import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.spark.SparkConf;
 import org.apache.spark.api.java.JavaSparkContext;
@@ -37,8 +39,13 @@ public class SparkUtil {
   public static SparkLauncher initLauncher(String propertiesFile) throws URISyntaxException {
     String currentJar = new File(SparkUtil.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath())
         .getAbsolutePath();
-    SparkLauncher sparkLauncher = new SparkLauncher().setAppResource(currentJar).setMainClass(SparkMain.class.getName())
-        .setPropertiesFile(propertiesFile);
+    SparkLauncher sparkLauncher = new SparkLauncher().setAppResource(currentJar)
+        .setMainClass(SparkMain.class.getName());
+
+    if (StringUtils.isNotEmpty(propertiesFile)) {
+      sparkLauncher.setPropertiesFile(propertiesFile);
+    }
+
     File libDirectory = new File(new File(currentJar).getParent(), "lib");
     for (String library : libDirectory.list()) {
       sparkLauncher.addJar(new File(libDirectory, library).getAbsolutePath());