From f1b75bdb51ebb8822dc799c6e692334d522e3aea Mon Sep 17 00:00:00 2001 From: NobiGo Date: Fri, 16 Apr 2021 14:45:32 +0800 Subject: [PATCH] [CALCITE-4585] when use prepareStatement parse and run RelNode or Queryable, Maybe Confusing log information be thrown --- .../apache/calcite/jdbc/CalciteConnectionImpl.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/apache/calcite/jdbc/CalciteConnectionImpl.java b/core/src/main/java/org/apache/calcite/jdbc/CalciteConnectionImpl.java index 1aab7d9a68ed..6721bf246c7f 100644 --- a/core/src/main/java/org/apache/calcite/jdbc/CalciteConnectionImpl.java +++ b/core/src/main/java/org/apache/calcite/jdbc/CalciteConnectionImpl.java @@ -222,8 +222,16 @@ private CalcitePreparedStatement prepareStatement_( server.getStatement(calcitePreparedStatement.handle).setSignature(signature); return calcitePreparedStatement; } catch (Exception e) { - throw Helper.INSTANCE.createException( - "Error while preparing statement [" + query.sql + "]", e); + if (null != query.sql) { + throw Helper.INSTANCE.createException( + "Error while preparing statement [" + query.sql + "]", e); + } else if (null != query.queryable) { + throw Helper.INSTANCE.createException( + "Error while preparing statement [" + query.queryable + "]", e); + } else { + throw Helper.INSTANCE.createException( + "Error while preparing statement [" + RelOptUtil.toString(query.rel) + "]", e); + } } }