alexott commented on a change in pull request #3579: [ZEPPELIN-4522]. Support 
multiple sql statements for SparkSqlInterpreter
URL: https://github.com/apache/zeppelin/pull/3579#discussion_r361839978
 
 

 ##########
 File path: 
spark/interpreter/src/main/java/org/apache/zeppelin/spark/SparkSqlInterpreter.java
 ##########
 @@ -82,26 +85,37 @@ public InterpreterResult internalInterpret(String st, 
InterpreterContext context
     sparkInterpreter.getZeppelinContext().setInterpreterContext(context);
     SQLContext sqlc = sparkInterpreter.getSQLContext();
     SparkContext sc = sqlc.sparkContext();
+
+    StringBuilder builder = new StringBuilder();
+    List<String> sqls = sqlSplitter.splitSql(st);
+    int maxResult = 
Integer.parseInt(context.getLocalProperties().getOrDefault("limit",
+            "" + sparkInterpreter.getZeppelinContext().getMaxResult()));
+
     sc.setLocalProperty("spark.scheduler.pool", 
context.getLocalProperties().get("pool"));
     sc.setJobGroup(Utils.buildJobGroupId(context), 
Utils.buildJobDesc(context), false);
-
+    String curSql = null;
     try {
-      Method method = sqlc.getClass().getMethod("sql", String.class);
-      int maxResult = 
Integer.parseInt(context.getLocalProperties().getOrDefault("limit",
-              "" + sparkInterpreter.getZeppelinContext().getMaxResult()));
-      String msg = sparkInterpreter.getZeppelinContext().showData(
-          method.invoke(sqlc, st), maxResult);
-      sc.clearJobGroup();
-      return new InterpreterResult(Code.SUCCESS, msg);
+      for (String sql : sqls) {
 
 Review comment:
   what will be in the `builder` if we'll have empty list of SQLs?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to