You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by li...@apache.org on 2024/01/16 05:13:45 UTC
(calcite) branch main updated: [CALCITE-6202] `sqlsh` does not print error message when query fails
This is an automated email from the ASF dual-hosted git repository.
libenchao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/main by this push:
new 86d5720c7f [CALCITE-6202] `sqlsh` does not print error message when query fails
86d5720c7f is described below
commit 86d5720c7fcfd73aa7c098adb54f96ad3aa80bfe
Author: Benchao Li <li...@gmail.com>
AuthorDate: Mon Jan 15 12:51:46 2024 +0800
[CALCITE-6202] `sqlsh` does not print error message when query fails
Close apache/calcite#3627
---
.../java/org/apache/calcite/adapter/os/SqlShell.java | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/plus/src/main/java/org/apache/calcite/adapter/os/SqlShell.java b/plus/src/main/java/org/apache/calcite/adapter/os/SqlShell.java
index 295b43678d..a9b4ee9b7f 100644
--- a/plus/src/main/java/org/apache/calcite/adapter/os/SqlShell.java
+++ b/plus/src/main/java/org/apache/calcite/adapter/os/SqlShell.java
@@ -118,17 +118,18 @@ public class SqlShell {
/** Main entry point. */
@SuppressWarnings("CatchAndPrintStackTrace")
public static void main(String[] args) {
- try (PrintWriter err =
- new PrintWriter(
- new OutputStreamWriter(System.err, StandardCharsets.UTF_8));
- InputStreamReader in =
- new InputStreamReader(System.in, StandardCharsets.UTF_8);
- PrintWriter out =
- new PrintWriter(
- new OutputStreamWriter(System.out, StandardCharsets.UTF_8))) {
+ try {
+ final PrintWriter err =
+ new PrintWriter(
+ new OutputStreamWriter(System.err, StandardCharsets.UTF_8));
+ final InputStreamReader in =
+ new InputStreamReader(System.in, StandardCharsets.UTF_8);
+ final PrintWriter out =
+ new PrintWriter(
+ new OutputStreamWriter(System.out, StandardCharsets.UTF_8));
new SqlShell(in, out, err, args).run();
} catch (Throwable e) {
- e.printStackTrace();
+ e.printStackTrace(System.err);
}
}