Skip to content

Commit 0ae83f4

Browse files
author
Alexander Bezzubov
committed
ZEPPELIN-46: set only non-empty properties for spark.*
1 parent 1df116f commit 0ae83f4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,17 +259,20 @@ public SparkContext createSparkContext() {
259259

260260
for (Object k : intpProperty.keySet()) {
261261
String key = (String) k;
262-
Object value = intpProperty.get(key);
263-
logger.debug(String.format("SparkConf: key = [%s], value = [%s]", key, value));
264-
conf.set(key, (String) value);
262+
String val = toString(intpProperty.get(key));
263+
264+
if (!val.startsWith("spark.") || !val.trim().isEmpty()) {
265+
logger.debug(String.format("SparkConf: key = [%s], value = [%s]", key, val));
266+
conf.set(key, val);
267+
}
265268
}
266269

267270
SparkContext sparkContext = new SparkContext(conf);
268271
return sparkContext;
269272
}
270273

271-
public static boolean isEmptyString(Object val) {
272-
return val instanceof String && ((String) val).trim().isEmpty();
274+
static final String toString(Object o) {
275+
return (o instanceof String) ? (String) o : "";
273276
}
274277

275278
public static String getSystemDefault(

0 commit comments

Comments
 (0)