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 d63358b7ea1..2b29eceadbc 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 @@ private InterpreterResult executeSql(String dbPrefix, String sql, List 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)