You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2020/12/28 03:40:02 UTC

[zeppelin] 01/01: [ZEPPELIN-5169]. Hive set statement doesn't work for some hive version when there's empty line ahead

This is an automated email from the ASF dual-hosted git repository.

zjffdu pushed a commit to branch ZEPPELIN-5169
in repository https://gitbox.apache.org/repos/asf/zeppelin.git

commit 304a77621d7767eb9c15522e68817f581b3f1474
Author: Jeff Zhang <zj...@apache.org>
AuthorDate: Wed Dec 23 09:48:45 2020 +0800

    [ZEPPELIN-5169]. Hive set statement doesn't work for some hive version when there's empty line ahead
---
 jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
index d63358b..2b29ece 100644
--- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
+++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
@@ -717,6 +717,11 @@ public class JDBCInterpreter extends KerberosInterpreter {
       List<String>  sqlArray = sqlSplitter.splitSql(sql);
       for (String sqlToExecute : sqlArray) {
         LOGGER.info("Execute sql: " + sqlToExecute);
+        if (sqlToExecute.trim().toLowerCase().startsWith("set ")) {
+          // some version of hive doesn't work with set statement with empty line ahead.
+          // so we need to trim it first in this case.
+          sqlToExecute = sqlToExecute.trim();
+        }
         statement = connection.createStatement();
 
         // fetch n+1 rows in order to indicate there's more rows available (for large selects)