[
https://issues.apache.org/jira/browse/CALCITE-4585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde updated CALCITE-4585:
---------------------------------
Description:
When use prepareStatement parse and run RelNode error, the exception's error
message is confusing.
In particular, if you prepare the statement using
{{RelRunner.prepare(RelNode)}} and prepare fails, the exception should report
the {{RelNode}} plan. Currently it tries to report the SQL, and for this kind
of query, there is no SQL.
This code capture the exception,But Only the output of SQL exception is
processed.So need to add the procedure to handle extra exception.
{code:java}
//
try {
final Meta.Signature signature =
parseQuery(query, createPrepareContext(), -1);
final CalcitePreparedStatement calcitePreparedStatement =
(CalcitePreparedStatement) factory.newPreparedStatement(this, null,
signature, resultSetType, resultSetConcurrency, resultSetHoldability);
server.getStatement(calcitePreparedStatement.handle).setSignature(signature);
return calcitePreparedStatement;
} catch (Exception e) {
throw Helper.INSTANCE.createException(
"Error while preparing statement [" + query.sql + "]", e);
}
{code}
When we run RelNode or queryable show wrong,this exception can be:
"Error while preparing statement [null]"
can't log the real exception
was:
When use prepareStatement parse and run RelNode error, the exception's error
message is confusing. This occurs especially when you use
{{RelRunner.prepare(RelNode)}} to prepare the statement.
This code capture the exception,But Only the output of SQL exception is
processed.So need to add the procedure to handle extra exception.
{code:java}
//
try {
final Meta.Signature signature =
parseQuery(query, createPrepareContext(), -1);
final CalcitePreparedStatement calcitePreparedStatement =
(CalcitePreparedStatement) factory.newPreparedStatement(this, null,
signature, resultSetType, resultSetConcurrency, resultSetHoldability);
server.getStatement(calcitePreparedStatement.handle).setSignature(signature);
return calcitePreparedStatement;
} catch (Exception e) {
throw Helper.INSTANCE.createException(
"Error while preparing statement [" + query.sql + "]", e);
}
{code}
When we run RelNode or queryable show wrong,this exception can be:
"Error while preparing statement [null]"
can't log the real exception
> Improve error message from RelRunner
> ------------------------------------
>
> Key: CALCITE-4585
> URL: https://issues.apache.org/jira/browse/CALCITE-4585
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.26.0
> Reporter: duan xiong
> Assignee: Julian Hyde
> Priority: Major
> Labels: pull-request-available
> Time Spent: 2h 40m
> Remaining Estimate: 0h
>
> When use prepareStatement parse and run RelNode error, the exception's error
> message is confusing.
> In particular, if you prepare the statement using
> {{RelRunner.prepare(RelNode)}} and prepare fails, the exception should report
> the {{RelNode}} plan. Currently it tries to report the SQL, and for this kind
> of query, there is no SQL.
> This code capture the exception,But Only the output of SQL exception is
> processed.So need to add the procedure to handle extra exception.
> {code:java}
> //
> try {
> final Meta.Signature signature =
> parseQuery(query, createPrepareContext(), -1);
> final CalcitePreparedStatement calcitePreparedStatement =
> (CalcitePreparedStatement) factory.newPreparedStatement(this, null,
> signature, resultSetType, resultSetConcurrency,
> resultSetHoldability);
>
> server.getStatement(calcitePreparedStatement.handle).setSignature(signature);
> return calcitePreparedStatement;
> } catch (Exception e) {
> throw Helper.INSTANCE.createException(
> "Error while preparing statement [" + query.sql + "]", e);
> }
> {code}
> When we run RelNode or queryable show wrong,this exception can be:
> "Error while preparing statement [null]"
> can't log the real exception
--
This message was sent by Atlassian Jira
(v8.3.4#803005)