This is an automated email from the ASF dual-hosted git repository.
feiwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new d7c1c94f2 [KYUUBI #4619] Fix beeline with -e When there are other SQL
statements before the source statement, the source statement cannot be executed
normally
d7c1c94f2 is described below
commit d7c1c94f23af5c9b37be2ea298e22bb5e63ae35f
Author: xu.guo <[email protected]>
AuthorDate: Tue Apr 4 09:36:05 2023 +0800
[KYUUBI #4619] Fix beeline with -e When there are other SQL statements
before the source statement, the source statement cannot be executed normally
### _Why are the changes needed?_
When using beeline -e, if there is a newline or space between the source
statement and the previous sql, the source statement will be misjudged as a sql
statement and sent to the server for execution


### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including
negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [ ] [Run
test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests)
locally before make a pull request
Closes #4619 from thomasg19930417/master.
Closes #4619
a2bfc0f0a [xu.guo] Fix When there are other sql before the source
statement, the source statement cannot be executed normally
1ec0b8124 [xu.guo] Fix When there are other sql before the source
statement, the source statement cannot be executed normally
9abba3cf5 [thomasgx] Merge branch 'apache:master' into master
f8405eb93 [Cheng Pan] Update
kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java
3ad46c1d6 [Cheng Pan] Update
kyuubi-hive-beeline/src/main/java/org/apache/hive/beeline/KyuubiCommands.java
31fa80771 [xu.guo] Merge branch 'master' of
https://github.com/thomasg19930417/kyuubi
41e090d66 [thomasgx] Merge branch 'apache:master' into master
ba82229a8 [xu.guo] Move initializeConsoleReader to KyuubiCommands#connect
e06927b78 [xu.guo] Replace create new consoleReader instance with call
initializeConsoleReader
86f2e5078 [xu.guo] Fix code style
b0c472229 [xu.guo] Fix Beeline with -i run sql faild
042987aa6 [xu.guo] Fix Beeline with -i run sql faild
Lead-authored-by: xu.guo <[email protected]>
Co-authored-by: thomasgx <[email protected]>
Co-authored-by: Cheng Pan <[email protected]>
Signed-off-by: fwang12 <[email protected]>
---
.../src/main/java/org/apache/hive/beeline/KyuubiCommands.java | 2 ++
1 file changed, 2 insertions(+)
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 311cb6a95..9ce4cb6f7 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
@@ -54,12 +54,14 @@ public class KyuubiCommands extends Commands {
}
private boolean isSourceCMD(String cmd) {
+ cmd = cmd.trim();
if (cmd == null || cmd.isEmpty()) return false;
String[] tokens = tokenizeCmd(cmd);
return tokens[0].equalsIgnoreCase("source");
}
private boolean sourceFile(String cmd) {
+ cmd = cmd.trim();
String[] tokens = tokenizeCmd(cmd);
String cmd_1 = getFirstCmd(cmd, tokens[0].length());