From 303a8bc395540e53c5b265dc18b5957994baaa64 Mon Sep 17 00:00:00 2001 From: Michael Spector Date: Mon, 26 Sep 2016 08:25:52 +0300 Subject: [PATCH] [ZEPPELIN-1486] Allow configuring whether shown values will be trimmed --- docs/interpreter/livy.md | 9 +++++++-- .../apache/zeppelin/livy/LivySparkSQLInterpreter.java | 3 ++- livy/src/main/resources/interpreter-setting.json | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/interpreter/livy.md b/docs/interpreter/livy.md index d725304c059..49ca7238ef9 100644 --- a/docs/interpreter/livy.md +++ b/docs/interpreter/livy.md @@ -61,16 +61,21 @@ Example: `spark.master` to `livy.spark.master` URL where livy server is running - zeppelin.livy.spark.maxResult + zeppelin.livy.spark.sql.maxResult 1000 Max number of Spark SQL result to display. + + zeppelin.livy.spark.sql.truncateResult + true + Whether to truncate long strings in SQL display. + zeppelin.livy.displayAppInfo false Whether to display app info - + livy.spark.driver.cores Driver cores. ex) 1, 2. diff --git a/livy/src/main/java/org/apache/zeppelin/livy/LivySparkSQLInterpreter.java b/livy/src/main/java/org/apache/zeppelin/livy/LivySparkSQLInterpreter.java index 3d4a0f4e428..89730e250ab 100644 --- a/livy/src/main/java/org/apache/zeppelin/livy/LivySparkSQLInterpreter.java +++ b/livy/src/main/java/org/apache/zeppelin/livy/LivySparkSQLInterpreter.java @@ -79,7 +79,8 @@ public InterpreterResult interpret(String line, InterpreterContext interpreterCo line.replaceAll("\"", "\\\\\"") .replaceAll("\\n", " ") + "\").show(" + - property.get("zeppelin.livy.spark.sql.maxResult") + ")", + property.get("zeppelin.livy.spark.sql.maxResult") + "," + + property.get("zeppelin.livy.spark.sql.truncateResult") + ")", interpreterContext, userSessionMap); if (res.code() == InterpreterResult.Code.SUCCESS) { diff --git a/livy/src/main/resources/interpreter-setting.json b/livy/src/main/resources/interpreter-setting.json index 4f2cf3d92cf..99e853dc455 100644 --- a/livy/src/main/resources/interpreter-setting.json +++ b/livy/src/main/resources/interpreter-setting.json @@ -108,6 +108,12 @@ "defaultValue": "1000", "description": "Max number of Spark SQL result to display." }, + "zeppelin.livy.spark.sql.truncateResult": { + "envName": "ZEPPELIN_LIVY_TRUNCATERESULT", + "propertyName": "zeppelin.livy.spark.sql.truncateResult", + "defaultValue": "true", + "description": "Truncate long strings in SQL display." + }, "zeppelin.livy.concurrentSQL": { "propertyName": "zeppelin.livy.concurrentSQL", "defaultValue": "false",