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

Josh Elser commented on CALCITE-1193:
-------------------------------------

re #1 Presently, we don't actually cache the Signature with the Statement 
handle inside the Avatica server. It looks like the only thing we don't include 
is the SQL itself (e.g. you could probably provide a Signature which only has 
the sql attribute and nothing else). We might be able to just cache the 
Signature as you say.

re #2 -- you're entirely correct. Making the server work with null or empty 
list is probably the best.

Any interest in fixing either of these yourself?

> NullPointerException when trying to execute prepared statement using avatica
> ----------------------------------------------------------------------------
>
>                 Key: CALCITE-1193
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1193
>             Project: Calcite
>          Issue Type: Bug
>          Components: avatica
>    Affects Versions: avatica-1.7.1
>         Environment: Phoenix 4.7.0 and Phoenix 4.8.0-SNAPSHOT
>            Reporter: Francis Chuang
>            Assignee: Josh Elser
>
> To reproduce, set the phoenix query server to use JSON for serialization:
> 1. Create a table called {{my_table}} and seed it using SquirrelSQL:
> {code}
> CREATE TABLE my_table (k BIGINT PRIMARY KEY, v VARCHAR) TRANSACTIONAL=true
> UPSERT INTO my_table VALUES (1,'A')
> UPSERT INTO my_table VALUES (2,'B')
> UPSERT INTO my_table VALUES (3,'C')
> UPSERT INTO my_table VALUES (4,'D')
> {code}
> Send the following requests using curl:
> {code}
> C:\Users\user
> λ curl localhost:8765 -XPOST --data '{"request": 
> "openConnection","connectionId": "my-conn"}'
> {"response":"openConnection","rpcMetadata":{"response":"rpcMetadata","serverAddress":"f826338-phoenix-server.f826338:8765"}}
> C:\Users\user
> λ curl localhost:8765 -XPOST --data '{"request": "prepare","connectionId": 
> "my-conn","sql": "SELECT * FROM my_table","maxRowCount": 1}'
> {"response":"prepare","statement":{"connectionId":"my-conn","id":36,"signature":{"columns":[{"ordinal":0,"autoIncrement":false,"caseSensitive":false,"searchable":true,"currency":false,"nullable":0,"signed":true,"displaySize":40,"label":"K","columnName":"K","schemaName":"","precision":0,"scale":0,"tableName":"MY_TABLE","catalogName":"","type":{"type":"scalar","id":-5,"name":"BIGINT","rep":"PRIMITIVE_LONG"},"readOnly":true,"writable":false,"definitelyWritable":false,"columnClassName":"java.lang.Long"},{"ordinal":1,"autoIncrement":false,"caseSensitive":false,"searchable":true,"currency":false,"nullable":1,"signed":false,"displaySize":40,"label":"V","columnName":"V","schemaName":"","precision":0,"scale":0,"tableName":"MY_TABLE","catalogName":"","type":{"type":"scalar","id":12,"name":"VARCHAR","rep":"STRING"},"readOnly":true,"writable":false,"definitelyWritable":false,"columnClassName":"java.lang.String"}],"sql":"SELECT
>  * FROM 
> my_table","parameters":[],"cursorFactory":{"style":"LIST","clazz":null,"fieldNames":null},"statementType":null}},"rpcMetadata":{"response":"rpcMetadata","serverAddress":"f826338-phoenix-server.f826338:8765"}}
> C:\Users\user
> λ curl localhost:8765 -XPOST --data '{"request": "execute","statementHandle": 
> {"connectionId": "my-conn","id": 36},"maxRowCount": 1}'
> {"response":"error","exceptions":["java.lang.NullPointerException\n\tat 
> org.apache.calcite.avatica.MetaImpl.checkParameterValueHasNull(MetaImpl.java:952)\n\tat
>  org.apache.calcite.avatica.jdbc.JdbcMeta.execute(JdbcMeta.java:781)\n\tat 
> org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:233)\n\tat
>  
> org.apache.calcite.avatica.remote.Service$ExecuteRequest.accept(Service.java:950)\n\tat
>  
> org.apache.calcite.avatica.remote.Service$ExecuteRequest.accept(Service.java:928)\n\tat
>  
> org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:102)\n\tat
>  
> org.apache.calcite.avatica.remote.JsonHandler.apply(JsonHandler.java:43)\n\tat
>  
> org.apache.calcite.avatica.server.AvaticaJsonHandler.handle(AvaticaJsonHandler.java:73)\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":"NullPointerException:
>  (null exception 
> message)","errorCode":-1,"sqlState":"00000","severity":"UNKNOWN","rpcMetadata":{"response":"rpcMetadata","serverAddress":"f826338-phoenix-server.f826338:8765"}}
> {code}
> Notice that the server throws a NPE when trying to execute the prepared 
> statement.



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

Reply via email to