You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Cong Luo (Jira)" <ji...@apache.org> on 2021/11/28 12:50:00 UTC

[jira] [Created] (PHOENIX-6607) Cannot use PreparedStatement in PQS client to write char array

Cong Luo created PHOENIX-6607:
---------------------------------

             Summary: Cannot use PreparedStatement in PQS client to write char array
                 Key: PHOENIX-6607
                 URL: https://issues.apache.org/jira/browse/PHOENIX-6607
             Project: Phoenix
          Issue Type: Bug
          Components: queryserver
            Reporter: Cong Luo


Use the PQS Client (6.0.0) with `PreparedStatement` to set the char array value got :

case 1 (use the pstmt) :
{code:java}
Array t_char = conn.createArrayOf("CHAR" , new String[] { "a", "b" });

pstmt = conn.prepareStatement("upsert into s1.datatype(t_uuid, t_char) values(?, ?)");

pstmt.setArray(2, t_char);{code}
{code:java}
Exception in thread "main" org.apache.calcite.avatica.AvaticaSqlException: Error -1 (00000) : Remote driver error: NullPointerException: (null exception message)     at org.apache.calcite.avatica.Helper.createException(Helper.java:54)     at org.apache.calcite.avatica.Helper.createException(Helper.java:41)     at org.apache.calcite.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:557)     at org.apache.calcite.avatica.AvaticaPreparedStatement.executeLargeUpdate(AvaticaPreparedStatement.java:152)     at org.apache.calcite.avatica.AvaticaPreparedStatement.executeUpdate(AvaticaPreparedStatement.java:147) java.lang.NullPointerException     at org.apache.phoenix.schema.types.PArrayDataType.toBytes(PArrayDataType.java:142)     at org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:192)     at org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:174)     at org.apache.phoenix.expression.LiteralExpression.newConstant(LiteralExpression.java:161)     at org.apache.phoenix.compile.UpsertCompiler$UpdateColumnCompiler.visit(UpsertCompiler.java:871)     at org.apache.phoenix.compile.UpsertCompiler$UpdateColumnCompiler.visit(UpsertCompiler.java:855)     at org.apache.phoenix.parse.BindParseNode.accept(BindParseNode.java:47)     at org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:744)     at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:784)     at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:770)     at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:401)     at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:391)     at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)     at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:389)     at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:378)     at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:173)     at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:183)     at org.apache.calcite.avatica.jdbc.JdbcMeta.execute(JdbcMeta.java:851)     at org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:254)     at org.apache.calcite.avatica.remote.Service$ExecuteRequest.accept(Service.java:1032)     at org.apache.calcite.avatica.remote.Service$ExecuteRequest.accept(Service.java:1002)     at org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:94)     at org.apache.calcite.avatica.remote.ProtobufHandler.apply(ProtobufHandler.java:46)     at org.apache.calcite.avatica.server.AvaticaProtobufHandler.handle(AvaticaProtobufHandler.java:127)     at org.apache.phoenix.shaded.org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)     at org.apache.phoenix.shaded.org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)     at org.apache.phoenix.shaded.org.eclipse.jetty.server.Server.handle(Server.java:499)     at org.apache.phoenix.shaded.org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)     at org.apache.phoenix.shaded.org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)     at org.apache.phoenix.shaded.org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)     at org.apache.phoenix.shaded.org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)     at org.apache.phoenix.shaded.org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
{code}
 

case 2 (use the sql text) :
{code:java}
pstmt = conn.prepareStatement("upsert into s1.datatype(t_uuid, t_char) values(?, ARRAY['a', 'b', 'c'])");{code}
{code:java}
return the correct results.{code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)