Author: praveen
Date: Sun Jan 25 06:01:24 2015
New Revision: 1654617
URL: http://svn.apache.org/r1654617
Log:
PIG-4390: Fix the NPE of System.getenv("SPARK_MASTER") in SparkLauncher.java
(liyunzhang via praveen)
Modified:
pig/branches/spark/src/org/apache/pig/backend/hadoop/executionengine/spark/SparkLauncher.java
Modified:
pig/branches/spark/src/org/apache/pig/backend/hadoop/executionengine/spark/SparkLauncher.java
URL:
http://svn.apache.org/viewvc/pig/branches/spark/src/org/apache/pig/backend/hadoop/executionengine/spark/SparkLauncher.java?rev=1654617&r1=1654616&r2=1654617&view=diff
==============================================================================
---
pig/branches/spark/src/org/apache/pig/backend/hadoop/executionengine/spark/SparkLauncher.java
(original)
+++
pig/branches/spark/src/org/apache/pig/backend/hadoop/executionengine/spark/SparkLauncher.java
Sun Jan 25 06:01:24 2015
@@ -179,7 +179,7 @@ public class SparkLauncher extends Launc
private void cleanUpSparkJob(PigContext pigContext, String
currentDirectoryPath) {
LOG.info("clean up Spark Job");
- boolean isLocal = System.getenv("SPARK_MASTER").equals("local");
+ boolean isLocal = System.getenv("SPARK_MASTER")!=
null?System.getenv("SPARK_MASTER").equalsIgnoreCase("LOCAL"): true;
if (isLocal) {
String shipFiles =
pigContext.getProperties().getProperty("pig.streaming.ship.files");
if (shipFiles != null) {
@@ -218,7 +218,7 @@ public class SparkLauncher extends Launc
File shipFile = new File(file.trim());
if (shipFile.exists()) {
LOG.info(String.format("shipFile:%s",shipFile));
- boolean isLocal =
System.getenv("SPARK_MASTER").equals("local");
+ boolean isLocal = System.getenv("SPARK_MASTER")!=
null?System.getenv("SPARK_MASTER").equalsIgnoreCase("LOCAL"): true;
if (isLocal) {
File localFile = new File(currentDirectoryPath+"/" +
shipFile.getName());
if( localFile.exists()){
@@ -239,7 +239,7 @@ public class SparkLauncher extends Launc
private void cacheFiles(String cacheFiles, String currentDirectoryPath,
PigContext pigContext) throws IOException {
if (cacheFiles != null) {
Configuration conf = SparkUtil.newJobConf(pigContext);
- boolean isLocal = System.getenv("SPARK_MASTER").equals("local");
+ boolean isLocal = System.getenv("SPARK_MASTER")!=
null?System.getenv("SPARK_MASTER").equalsIgnoreCase("LOCAL"): true;
for (String file : cacheFiles.split(",")) {
String fileName = extractFileName(file.trim());
Path src = new Path(extractFileUrl(file.trim()));