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:01 UTC

[zeppelin] branch ZEPPELIN-5169 created (now 304a776)

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

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


      at 304a776  [ZEPPELIN-5169]. Hive set statement doesn't work for some hive version when there's empty line ahead

This branch includes the following new commits:

     new 304a776  [ZEPPELIN-5169]. Hive set statement doesn't work for some hive version when there's empty line ahead

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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

Posted by zj...@apache.org.
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)