You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by fe...@apache.org on 2022/12/20 12:49:44 UTC
[incubator-kyuubi] branch master updated: [KYUUBI #4006] Fix the incorrect execution of the source command
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/incubator-kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new a494aa9b8 [KYUUBI #4006] Fix the incorrect execution of the source command
a494aa9b8 is described below
commit a494aa9b8765f3183c960825a5b1a1b47bc2b8a7
Author: wForget <64...@qq.com>
AuthorDate: Tue Dec 20 20:49:37 2022 +0800
[KYUUBI #4006] Fix the incorrect execution of the source command
### _Why are the changes needed?_
close #4006
refer https://github.com/apache/hive/blob/7c343471aa68d7d06209694d9d6b181bd58e0793/beeline/src/java/org/apache/hive/beeline/Commands.java#L856
### _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
Successfully executed after fix:

- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #4007 from wForget/KYUUBI-4006.
Closes #4006
0a9710503 [wForget] Fix comment extra never reads next line
47b30247f [wForget] [KYUUBI-4006] Fix the incorrect execution of the source command
Authored-by: wForget <64...@qq.com>
Signed-off-by: fwang12 <fw...@ebay.com>
---
.../src/main/java/org/apache/hive/beeline/KyuubiCommands.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
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 311495212..572417847 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
@@ -45,7 +45,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);
+ return cmd.substring(length).trim();
}
private String[] tokenizeCmd(String cmd) {
@@ -82,9 +82,8 @@ public class KyuubiCommands extends Commands {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(sourceFile));
- String extra = reader.readLine();
- String lines = null;
- while (extra != null) {
+ String lines = null, extra;
+ while ((extra = reader.readLine()) != null) {
if (beeLine.isComment(extra)) {
continue;
}
@@ -93,7 +92,6 @@ public class KyuubiCommands extends Commands {
} else {
lines += "\n" + extra;
}
- extra = reader.readLine();
}
String[] cmds = lines.split(";");
for (String c : cmds) {