Skip to content

Commit

Permalink
[KYUUBI #4406] Revert "[KYUUBI #4305][Bug] Backport HIVE-15820: comme…
Browse files Browse the repository at this point in the history
…nt at the head …

…of beeline -e"

This reverts commit c489e29.

### _Why are the changes needed?_

#4333 (comment)

### _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 #4406 from cfmcgrady/revert-4333.

Closes #4406

Closes #4305

c7fff72 [Fu Chen] Revert "[KYUUBI #4305][Bug] Backport HIVE-15820: comment at the head of beeline -e"

Authored-by: Fu Chen <cfmcgrady@gmail.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
(cherry picked from commit b39caed)
Signed-off-by: Cheng Pan <chengpan@apache.org>
  • Loading branch information
cfmcgrady authored and pan3793 committed Feb 24, 2023
1 parent 632c64d commit 962ccf6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.hive.common.util.HiveStringUtils;

public class KyuubiBeeLine extends BeeLine {
public static final String KYUUBI_BEELINE_DEFAULT_JDBC_DRIVER =
Expand Down Expand Up @@ -193,9 +192,4 @@ int initArgs(String[] args) {
}
return code;
}

@Override
boolean dispatch(String line) {
return super.dispatch(HiveStringUtils.removeComments(line));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
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.KyuubiStatement;
import org.apache.kyuubi.jdbc.hive.Utils;
import org.apache.kyuubi.jdbc.hive.logs.InPlaceUpdateStream;
Expand Down Expand Up @@ -500,7 +499,7 @@ public boolean connect(Properties props) throws IOException {

@Override
public String handleMultiLineCmd(String line) throws IOException {
line = HiveStringUtils.removeComments(line);
int[] startQuote = {-1};
Character mask =
(System.getProperty("jline.terminal", "").equals("jline.UnsupportedTerminal"))
? null
Expand Down Expand Up @@ -531,8 +530,7 @@ public String handleMultiLineCmd(String line) throws IOException {
if (extra == null) { // it happens when using -f and the line of cmds does not end with ;
break;
}
extra = HiveStringUtils.removeComments(extra);
if (extra != null && !extra.isEmpty()) {
if (!extra.isEmpty()) {
line += "\n" + extra;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,4 @@ public void testKyuubiBeelineWithoutArgs() {
int result = kyuubiBeeLine.initArgs(new String[0]);
assertEquals(0, result);
}

@Test
public void testKyuubiBeelineComment() {
KyuubiBeeLine kyuubiBeeLine = new KyuubiBeeLine();
int result = kyuubiBeeLine.initArgsFromCliVars(new String[] {"-e", "--comment show database;"});
assertEquals(0, result);
result = kyuubiBeeLine.initArgsFromCliVars(new String[] {"-e", "--comment\n show database;"});
assertEquals(1, result);
result =
kyuubiBeeLine.initArgsFromCliVars(
new String[] {"-e", "--comment line 1 \n --comment line 2 \n show database;"});
assertEquals(1, result);
}
}

0 comments on commit 962ccf6

Please sign in to comment.