[
https://issues.apache.org/jira/browse/CALCITE-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15235274#comment-15235274
]
Josh Elser commented on CALCITE-1193:
-------------------------------------
The following is the request and response for the Execute call from the above
unit test (I change the table name from "test" to "preparedStmtNoParameters",
btw):
{noformat}
[
{
"request": "execute",
"statementHandle": {
"connectionId": "8b85096e-9c42-441e-a38e-57e39fa42cb7",
"id": 1,
"signature": {
"columns": [
{
"ordinal": 0,
"autoIncrement": false,
"caseSensitive": false,
"searchable": true,
"currency": false,
"nullable": 1,
"signed": true,
"displaySize": 11,
"label": "ID",
"columnName": "ID",
"schemaName": "SCOTT",
"precision": 32,
"scale": 0,
"tableName": "PREPAREDSTMTNOPARAMETERS",
"catalogName": "PUBLIC",
"type": {
"type": "scalar",
"id": 4,
"name": "INTEGER",
"rep": "NUMBER"
},
"readOnly": false,
"writable": false,
"definitelyWritable": false,
"columnClassName": "java.lang.Integer"
}
],
"sql": "SELECT * FROM preparedStmtNoParameters",
"parameters": [
],
"cursorFactory": {
"style": "LIST",
"clazz": null,
"fieldNames": null
},
"statementType": null
}
},
"parameterValues": [
],
"maxRowCount": 100
},
{
"response": "executeResults",
"missingStatement": false,
"rpcMetadata": null,
"results": [
{
"response": "resultSet",
"connectionId": "8b85096e-9c42-441e-a38e-57e39fa42cb7",
"statementId": 1,
"ownStatement": true,
"signature": {
"columns": [
{
"ordinal": 0,
"autoIncrement": false,
"caseSensitive": false,
"searchable": true,
"currency": false,
"nullable": 1,
"signed": true,
"displaySize": 11,
"label": "ID",
"columnName": "ID",
"schemaName": "SCOTT",
"precision": 32,
"scale": 0,
"tableName": "PREPAREDSTMTNOPARAMETERS",
"catalogName": "PUBLIC",
"type": {
"type": "scalar",
"id": 4,
"name": "INTEGER",
"rep": "PRIMITIVE_INT"
},
"readOnly": false,
"writable": false,
"definitelyWritable": false,
"columnClassName": "java.lang.Integer"
}
],
"sql": "SELECT * FROM preparedStmtNoParameters",
"parameters": [
],
"cursorFactory": {
"style": "LIST",
"clazz": null,
"fieldNames": null
},
"statementType": "SELECT"
},
"firstFrame": {
"offset": 0,
"done": true,
"rows": [
]
},
"updateCount": -1,
"rpcMetadata": null
}
]
}
]
{noformat}
Looks like essentially the same thing you're doing, except you didn't provide
the signature (but that shouldn't matter). FWIW, I'm also using a fresh build
of 1.8.0-SNAPSHOT.
> 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)