address comments

This commit is contained in:
Jeff Zhang 2017-03-30 13:46:49 +08:00
parent 4193ee321e
commit f821839700
7 changed files with 18 additions and 20 deletions

View file

@ -141,9 +141,9 @@ You can also set other Spark properties which are not listed in the table. For a
<td>Import implicits, UDF collection, and sql if set true.</td>
</tr>
<tr>
<td>zeppelin.spark.unSupportedVersionCheck</td>
<td>zeppelin.spark.enableSupportedVersionCheck</td>
<td>true</td>
<td>Don't change it, It is only for zeppelin developer use, not safe or use in production</td>
<td>Do not change - developer only setting, not for production use</td>
</tr>
</table>

View file

@ -337,8 +337,7 @@ public class PySparkInterpreter extends Interpreter implements ExecuteResultHand
public InterpreterResult interpret(String st, InterpreterContext context) {
SparkInterpreter sparkInterpreter = getSparkInterpreter();
sparkInterpreter.populateSparkWebUrl(context);
if (sparkInterpreter.isUnsupportedVersionCheck
&& sparkInterpreter.getSparkVersion().isUnsupportedVersion()) {
if (sparkInterpreter.isUnsupportedSparkVersion()) {
return new InterpreterResult(Code.ERROR, "Spark "
+ sparkInterpreter.getSparkVersion().toString() + " is not supported");
}
@ -467,9 +466,7 @@ public class PySparkInterpreter extends Interpreter implements ExecuteResultHand
//start code for completion
SparkInterpreter sparkInterpreter = getSparkInterpreter();
if (sparkInterpreter.isUnsupportedVersionCheck
&& sparkInterpreter.getSparkVersion().isUnsupportedVersion() == false
&& pythonscriptRunning == false) {
if (sparkInterpreter.isUnsupportedSparkVersion() || pythonscriptRunning == false) {
return new LinkedList<>();
}

View file

@ -43,7 +43,6 @@ import org.apache.spark.repl.SparkILoop;
import org.apache.spark.scheduler.ActiveJob;
import org.apache.spark.scheduler.DAGScheduler;
import org.apache.spark.scheduler.Pool;
import org.apache.spark.scheduler.SparkListenerApplicationEnd;
import org.apache.spark.scheduler.SparkListenerJobStart;
import org.apache.spark.sql.SQLContext;
import org.apache.spark.ui.SparkUI;
@ -128,7 +127,7 @@ public class SparkInterpreter extends Interpreter {
private static File outputDir; // class outputdir for scala 2.11
private Object classServer; // classserver for scala 2.11
private JavaSparkContext jsc;
boolean isUnsupportedVersionCheck;
private boolean enableSupportedVersionCheck;
public SparkInterpreter(Properties property) {
super(property);
@ -609,8 +608,8 @@ public class SparkInterpreter extends Interpreter {
@Override
public void open() {
this.isUnsupportedVersionCheck = java.lang.Boolean.parseBoolean(
property.getProperty("zeppelin.spark.unSupportedVersionCheck", "true"));
this.enableSupportedVersionCheck = java.lang.Boolean.parseBoolean(
property.getProperty("zeppelin.spark.enableSupportedVersionCheck", "true"));
// set properties and do login before creating any spark stuff for secured cluster
if (isYarnMode()) {
@ -1156,12 +1155,16 @@ public class SparkInterpreter extends Interpreter {
return obj;
}
boolean isUnsupportedSparkVersion() {
return enableSupportedVersionCheck && sparkVersion.isUnsupportedVersion();
}
/**
* Interpret a single line.
*/
@Override
public InterpreterResult interpret(String line, InterpreterContext context) {
if (isUnsupportedVersionCheck && sparkVersion.isUnsupportedVersion()) {
if (isUnsupportedSparkVersion()) {
return new InterpreterResult(Code.ERROR, "Spark " + sparkVersion.toString()
+ " is not supported");
}

View file

@ -108,8 +108,7 @@ public class SparkRInterpreter extends Interpreter {
SparkInterpreter sparkInterpreter = getSparkInterpreter();
sparkInterpreter.populateSparkWebUrl(interpreterContext);
if (sparkInterpreter.isUnsupportedVersionCheck
&& sparkInterpreter.getSparkVersion().isUnsupportedVersion()) {
if (sparkInterpreter.isUnsupportedSparkVersion()) {
return new InterpreterResult(InterpreterResult.Code.ERROR, "Spark "
+ sparkInterpreter.getSparkVersion().toString() + " is not supported");
}

View file

@ -87,8 +87,7 @@ public class SparkSqlInterpreter extends Interpreter {
SQLContext sqlc = null;
SparkInterpreter sparkInterpreter = getSparkInterpreter();
if (sparkInterpreter.isUnsupportedVersionCheck
&& sparkInterpreter.getSparkVersion().isUnsupportedVersion()) {
if (sparkInterpreter.isUnsupportedSparkVersion()) {
return new InterpreterResult(Code.ERROR, "Spark "
+ sparkInterpreter.getSparkVersion().toString() + " is not supported");
}

View file

@ -56,9 +56,9 @@
},
"zeppelin.spark.unSupportedVersionCheck": {
"envName": null,
"propertyName": "zeppelin.spark.unSupportedVersionCheck",
"propertyName": "zeppelin.spark.enableSupportedVersionCheck",
"defaultValue": "true",
"description": "Don't change it, It is only for zeppelin developer use, not safe to use in production"
"description": "Do not change - developer only setting, not for production use"
}
},
"editor": {

View file

@ -56,9 +56,9 @@
},
"zeppelin.spark.unSupportedVersionCheck": {
"envName": null,
"propertyName": "zeppelin.spark.unSupportedVersionCheck",
"propertyName": "zeppelin.spark.enableSupportedVersionCheck",
"defaultValue": "true",
"description": "Don't change it, It is only for zeppelin developer use, not safe to use in production"
"description": "Do not change - developer only setting, not for production use"
}
},
"editor": {