You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Francis Chuang (JIRA)" <ji...@apache.org> on 2018/04/10 11:54:00 UTC

[jira] [Commented] (CALCITE-1049) SQLException not correctly propagated

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

Francis Chuang commented on CALCITE-1049:
-----------------------------------------

Also running into this with the HSQLDB backend while testing the Avatica Go client. With the HSQLDB backend, the error code is always 4294967295 (max of a 32-bit int) and the sqlState is always 00000 (meaning the query was successful). For Phoenix, the error code and sqlState is in the error message, so I can parse them out using some regex (not ideal though), but they are not present the HSQLDB adapter's error messages, so it's impossible to get the error code and sqlState.

> 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
>            Priority: Major
>
> 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
(v7.6.3#76005)