levi0090 commented on code in PR #4675:
URL: https://github.com/apache/zeppelin/pull/4675#discussion_r1359760563


##########
livy/src/main/java/org/apache/zeppelin/livy/LivySparkSQLInterpreter.java:
##########
@@ -180,26 +181,50 @@ protected List<String> parseSQLJsonOutput(String output) {
     List<String> rows = new ArrayList<>();
 
     String[] rowsOutput = output.split("(?<!\\\\)\\n");
+
+    if (rowsOutput.length < 2){
+      return Arrays.asList(rowsOutput);
+    }
+
     String[] header = rowsOutput[1].split("\t");
     List<String> cells = new ArrayList<>(Arrays.asList(header));
     rows.add(StringUtils.join(cells, "\t"));
 
     for (int i = 2; i < rowsOutput.length; i++) {
-      Map<String, String> retMap = new Gson().fromJson(
-          rowsOutput[i], new TypeToken<HashMap<String, String>>() {
-          }.getType()
-      );
+      // one-by-one serialization to handle the case when
+      // the value is non-primitive such as: {"lang": ["java", "NodeJS"]}.
+      Map<String, String> retMap = serialize(rowsOutput[i]);
+
       cells = new ArrayList<>();
       for (String s : header) {
         cells.add(retMap.getOrDefault(s, "null")
             .replace("\n", "\\n")
             .replace("\t", "\\t"));
       }
       rows.add(StringUtils.join(cells, "\t"));
+
     }
     return rows;
   }
 
+  private Map<String, String> serialize(String jsonString) {

Review Comment:
   Thanks for catching that. . Fixed. 
https://github.com/apache/zeppelin/pull/4675/commits/fbf6c98aa0ff91059bfd1d7f5fba0360a0a04bab



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@zeppelin.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to