mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
[ZEPPELIN-1965] Livy SQL Interpreter: Should use df.show(1000, false) to display results
This commit is contained in:
parent
4a466d0605
commit
b6252be466
2 changed files with 11 additions and 2 deletions
|
|
@ -36,10 +36,12 @@ public class LivySparkSQLInterpreter extends BaseLivyInterprereter {
|
|||
|
||||
private boolean isSpark2 = false;
|
||||
private int maxResult = 1000;
|
||||
private boolean truncate = true;
|
||||
|
||||
public LivySparkSQLInterpreter(Properties property) {
|
||||
super(property);
|
||||
this.maxResult = Integer.parseInt(property.getProperty("zeppelin.livy.spark.sql.maxResult"));
|
||||
this.truncate = Boolean.parseBoolean(property.getProperty("zeppelin.livy.spark.sql.truncate"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -111,9 +113,11 @@ public class LivySparkSQLInterpreter extends BaseLivyInterprereter {
|
|||
// use triple quote so that we don't need to do string escape.
|
||||
String sqlQuery = null;
|
||||
if (isSpark2) {
|
||||
sqlQuery = "spark.sql(\"\"\"" + line + "\"\"\").show(" + maxResult + ")";
|
||||
sqlQuery = "spark.sql(\"\"\"" + line + "\"\"\").show(" + maxResult + ", " +
|
||||
truncate + ")";
|
||||
} else {
|
||||
sqlQuery = "sqlContext.sql(\"\"\"" + line + "\"\"\").show(" + maxResult + ")";
|
||||
sqlQuery = "sqlContext.sql(\"\"\"" + line + "\"\"\").show(" + maxResult + ", " +
|
||||
truncate + ")";
|
||||
}
|
||||
InterpreterResult result = sparkInterpreter.interpret(sqlQuery, context.getParagraphId(),
|
||||
this.displayAppInfo, true);
|
||||
|
|
|
|||
|
|
@ -118,6 +118,11 @@
|
|||
"defaultValue": "1000",
|
||||
"description": "Max number of Spark SQL result to display."
|
||||
},
|
||||
"zeppelin.livy.spark.sql.truncate": {
|
||||
"propertyName": "zeppelin.livy.spark.sql.truncate",
|
||||
"defaultValue": "true",
|
||||
"description": "If true, truncate strings greater than 20 characters."
|
||||
},
|
||||
"zeppelin.livy.concurrentSQL": {
|
||||
"propertyName": "zeppelin.livy.concurrentSQL",
|
||||
"defaultValue": "false",
|
||||
|
|
|
|||
Loading…
Reference in a new issue