Skip to content

Commit 637c236

Browse files
committed
debug - temporary, will be removed
1 parent 806ca9c commit 637c236

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

beeline/src/java/org/apache/hive/beeline/BeeLine.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,11 +560,13 @@ public static void mainWithInputRedirection(String[] args, InputStream inputStre
560560
BeeLine beeLine = new BeeLine();
561561
try {
562562
int status = beeLine.begin(args, inputStream);
563+
System.out.println("after beeline.begin");
563564

564565
if (!Boolean.getBoolean(BeeLineOpts.PROPERTY_NAME_EXIT)) {
565566
System.exit(status);
566567
}
567568
} finally {
569+
System.out.println("mainWithInputRedirection ends, called finally");
568570
beeLine.close();
569571
}
570572
}
@@ -577,6 +579,7 @@ public BeeLine(boolean isBeeLine) {
577579
this.isBeeLine = isBeeLine;
578580
this.signalHandler = new SunSignalHandler(this);
579581
this.shutdownHook = () -> {
582+
info("Running shutdown hook");
580583
try {
581584
if (history != null) {
582585
history.save();
@@ -1124,6 +1127,7 @@ public int begin(String[] args, InputStream inputStream, boolean keepHistory) th
11241127
initializeLineReader();
11251128
if (isBeeLine) {
11261129
int code = initArgs(args);
1130+
info("initArgs returns: " + code);
11271131
if (code != 0) {
11281132
return code;
11291133
}
@@ -1306,6 +1310,7 @@ int runInit() {
13061310
}
13071311
}
13081312
}
1313+
info(String.format("initialized, exit: %s, executionResult: %d", exit, executionResult));
13091314
return executionResult;
13101315
}
13111316

@@ -1372,13 +1377,15 @@ private int executeFile(String fileName) {
13721377
}
13731378

13741379
private int execute(LineReader reader, boolean exitOnError) {
1380+
System.out.println("Execute with line reader");
13751381
int lastExecutionResult = ERRNO_OK;
13761382
Character mask = (System.getProperty("jline.terminal", "").equals("jline.UnsupportedTerminal")) ? null
13771383
: LineReaderImpl.NULL_MASK;
13781384

13791385
String line;
13801386
while (!exit) {
13811387
try {
1388+
info("trying to parse next line");
13821389
// Execute one instruction; terminate on executing a script if there is an error
13831390
// in silent mode, prevent the query and prompt being echoed back to terminal
13841391
line = (getOpts().isSilent() && getOpts().getScriptFile() != null) ? reader
@@ -1398,6 +1405,7 @@ private int execute(LineReader reader, boolean exitOnError) {
13981405
lastExecutionResult = ERRNO_OK;
13991406
}
14001407
} catch (EndOfFileException t) {
1408+
info("EndOfFileException caught");
14011409
/*
14021410
* If you're reading from a normal file (not from standard input or a terminal), JLine might raise an
14031411
* EndOfFileException when it reaches the end of the file. JLine uses readLine() for reading input, and it
@@ -1431,6 +1439,7 @@ private void setupHistory() throws IOException {
14311439

14321440
private void addBeelineShutdownHook() throws IOException {
14331441
// add shutdown hook to flush the history to history file and it also close all open connections
1442+
info("Add shutdown hook");
14341443
ShutdownHookManager.addShutdownHook(getShutdownHook());
14351444
}
14361445

@@ -1492,9 +1501,11 @@ private InputStream prepareInputStream(InputStream inputStream) {
14921501

14931502
protected Terminal buildTerminal(InputStream inputStream) throws IOException {
14941503
if (inputStream != null) { // typically when there is a file script to read from
1504+
info("Build terminal on stream");
14951505
return TerminalBuilder.builder().streams(inputStream, getErrorStream()).build();
14961506
} else { // no input stream, normal operation: proper behavior needs a system terminal
14971507
// system terminal can only be created with system streams
1508+
info("Build terminal on system in/err");
14981509
return TerminalBuilder.builder().system(true).dumb(false).streams(System.in, System.err).build();
14991510
}
15001511
}

beeline/src/java/org/apache/hive/beeline/Commands.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,7 @@ public boolean properties(String line) throws Exception {
15141514

15151515

15161516
public boolean connect(String line) throws Exception {
1517+
beeLine.info("Connect: line: " + line);
15171518
String example = "Usage: connect <url> <username> <password> [driver]"
15181519
+ BeeLine.getSeparator();
15191520

0 commit comments

Comments
 (0)