cfmcgrady commented on PR #4965: URL: https://github.com/apache/kyuubi/pull/4965#issuecomment-1592688862
Should we consider reverting the removal of the `trim` related operation that was committed in https://github.com/apache/kyuubi/pull/3762? It's dangerous for non-python mode. ```diff diff --git a/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java b/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java index e3a4b295e..3ffe7aee7 100644 --- a/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java +++ b/kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java @@ -21,7 +21,6 @@ import java.io.*; import java.sql.*; import java.util.*; import org.apache.hive.beeline.logs.KyuubiBeelineInPlaceUpdateStream; -import org.apache.hive.common.util.HiveStringUtils; import org.apache.kyuubi.jdbc.hive.JdbcConnectionParams; import org.apache.kyuubi.jdbc.hive.KyuubiStatement; import org.apache.kyuubi.jdbc.hive.Utils; @@ -45,7 +44,7 @@ public class KyuubiCommands extends Commands { /** Extract and clean up the first command in the input. */ private String getFirstCmd(String cmd, int length) { - return cmd.substring(length).trim(); + return cmd.substring(length); } private String[] tokenizeCmd(String cmd) { @@ -97,7 +96,6 @@ public class KyuubiCommands extends Commands { } String[] cmds = lines.split(";"); for (String c : cmds) { - c = c.trim(); if (!executeInternal(c, false)) { return false; } @@ -261,10 +259,9 @@ public class KyuubiCommands extends Commands { beeLine.handleException(e); } - line = line.trim(); List<String> cmdList = getCmdList(line, entireLineAsCommand); for (int i = 0; i < cmdList.size(); i++) { - String sql = cmdList.get(i).trim(); + String sql = cmdList.get(i); if (sql.length() != 0) { if (!executeInternal(sql, call)) { return false; @@ -511,7 +508,6 @@ public class KyuubiCommands extends Commands { @Override public String handleMultiLineCmd(String line) throws IOException { int[] startQuote = {-1}; - line = HiveStringUtils.removeComments(line, startQuote); Character mask = (System.getProperty("jline.terminal", "").equals("jline.UnsupportedTerminal")) ? null @@ -542,7 +538,6 @@ public class KyuubiCommands extends Commands { if (extra == null) { // it happens when using -f and the line of cmds does not end with ; break; } - extra = HiveStringUtils.removeComments(extra, startQuote); if (!extra.isEmpty()) { line += "\n" + extra; } @@ -554,13 +549,12 @@ public class KyuubiCommands extends Commands { // console. Used in handleMultiLineCmd method assumes line would never be null when this method is // called private boolean isMultiLine(String line) { - line = line.trim(); if (line.endsWith(beeLine.getOpts().getDelimiter()) || beeLine.isComment(line)) { return false; } // handles the case like line = show tables; --test comment List<String> cmds = getCmdList(line, false); - return cmds.isEmpty() || !cmds.get(cmds.size() - 1).trim().startsWith("--"); + return cmds.isEmpty() || !cmds.get(cmds.size() - 1).startsWith("--"); } static class KyuubiLogRunnable implements Runnable { ``` -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
