[ 
https://issues.apache.org/jira/browse/CALCITE-1049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15092622#comment-15092622
 ] 

Josh Elser commented on CALCITE-1049:
-------------------------------------

I think your assessment is right, [~lukaslalinsky]. I remember I stubbed out 
the necessary information, but wasn't positive that all of the paths where we 
now catch an RTE and turn it into an ErrorResponse are properly caught. It 
seems like you definitely found one :)

> SQLException not correctly propagated
> -------------------------------------
>
>                 Key: CALCITE-1049
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1049
>             Project: Calcite
>          Issue Type: Bug
>          Components: avatica
>    Affects Versions: 1.5.0
>            Reporter: Lukas Lalinsky
>            Assignee: Julian Hyde
>
> When using the Phoenix (master) and it raises a SQLException, this is 
> returned from the Avatica RPC server:
> {code}
> {
>   "response":"error",
>   "exceptions":[
>     "java.lang.RuntimeException: ERROR 202 (22012): Divide by zero.\n"
>     "\tat 
> org.apache.calcite.avatica.jdbc.JdbcMeta.propagate(JdbcMeta.java:651)\n"
>     "\tat 
> org.apache.calcite.avatica.jdbc.JdbcMeta.prepareAndExecute(JdbcMeta.java:715)\n"
>     "\tat 
> org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:179)\n"
>     "\tat 
> org.apache.calcite.avatica.remote.Service$PrepareAndExecuteRequest.accept(Service.java:1049)\n"
>     "\tat 
> org.apache.calcite.avatica.remote.Service$PrepareAndExecuteRequest.accept(Service.java:1023)\n"
>     "\tat 
> org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:100)\n"
>     "\tat 
> org.apache.calcite.avatica.remote.JsonHandler.apply(JsonHandler.java:43)\n"
>     "\tat 
> org.apache.calcite.avatica.server.AvaticaHandler.handle(AvaticaHandler.java:68)\n"
>     "\tat 
> org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)\n"
>     "\tat 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)\n"
>     "\tat org.eclipse.jetty.server.Server.handle(Server.java:497)\n"
>     "\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)\n"
>     "\tat 
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:245)\n"
>     "\tat 
> org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)\n"
>     "\tat 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)\n"
>     "\tat 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)\n"
>     "\tat java.lang.Thread.run(Thread.java:745)\n"
>   ],
>   "errorMessage":"ERROR 202 (22012): Divide by zero.",
>   "errorCode":-1,
>   "sqlState":"00000",
>   "severity":"UNKNOWN"
> }
> {code}
> The SQLException is translated to RuntimeException and the errorCode and 
> sqlState fields are set to "unknown" values, even though the codes were 
> originally set in the SQLException.
> I'd expect that 
> https://github.com/apache/calcite/blob/calcite-1.5.0/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java#L645
>  would have a special case for SQLException and translate it to 
> AvaticaRuntimeException. I'm not sure if that is the correct solution.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to