Lukas Lalinsky created PHOENIX-2082:
---------------------------------------
Summary: Can't send UNSIGNED_TINYINT as a query parameter using
query server
Key: PHOENIX-2082
URL: https://issues.apache.org/jira/browse/PHOENIX-2082
Project: Phoenix
Issue Type: Bug
Reporter: Lukas Lalinsky
I'm not 100% if this is not a problem in my code, but it seems to me that the
adapter between Avatica and Phoenix doesn't know how to translate int from the
JSON request to UNSIGNED_TINYINT (note that TINYINT works fine).
Here is are example requests I'm sending to the query server:
{code}
{'connectionId': '78db88ad-a3fe-467b-81b4-671acb3e02e7',
'maxRowCount': -1,
'request': 'prepare',
'sql': 'UPSERT INTO phoenixdb_test_tbl1 VALUES (6, ?)'}
{code}
followed by:
{code}
{'connectionId': '78db88ad-a3fe-467b-81b4-671acb3e02e7',
'fetchMaxRowCount': -1,
'offset': 0,
'parameterValues': [127],
'request': 'fetch',
'statementId': 1762997996}
{code}
The result is this exception:
{noformat}
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: java.lang.RuntimeException:
org.apache.phoenix.schema.TypeMismatchException: ERROR 203 (22005): Type
mismatch. UNSIGNED_TINYINT and INTEGER for 127
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.calcite.avatica.jdbc.JdbcMeta.propagate(JdbcMeta.java:737)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.calcite.avatica.jdbc.JdbcMeta.fetch(JdbcMeta.java:821)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:162)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.calcite.avatica.remote.Service$FetchRequest.accept(Service.java:314)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.calcite.avatica.remote.Service$FetchRequest.accept(Service.java:288)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.calcite.avatica.remote.JsonHandler.apply(JsonHandler.java:43)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.calcite.avatica.server.AvaticaHandler.handle(AvaticaHandler.java:55)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.eclipse.jetty.server.Server.handle(Server.java:497)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:245)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
java.lang.Thread.run(Thread.java:745)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: Caused by:
org.apache.phoenix.schema.TypeMismatchException: ERROR 203 (22005): Type
mismatch. UNSIGNED_TINYINT and INTEGER for 127
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.schema.TypeMismatchException.newException(TypeMismatchException.java:53)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:171)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:143)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.compile.UpsertCompiler$UpsertValuesCompiler.visit(UpsertCompiler.java:858)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.compile.UpsertCompiler$UpsertValuesCompiler.visit(UpsertCompiler.java:842)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.parse.BindParseNode.accept(BindParseNode.java:47)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:733)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:528)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:516)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:302)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:295)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:293)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:225)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:173)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:178)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: at
org.apache.calcite.avatica.jdbc.JdbcMeta.fetch(JdbcMeta.java:811)
Jun 28 23:07:12 vagrant-ubuntu-vivid-64 hbase[674]: ... 14 more
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)