[
https://issues.apache.org/jira/browse/PHOENIX-6602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17448406#comment-17448406
]
Istvan Toth edited comment on PHOENIX-6602 at 11/24/21, 7:10 AM:
-----------------------------------------------------------------
Am I right to assume that you are writing a native perl client for Avatica /
PQS?
You may want to discuss that on either or both of the Avatica and Phoenix
mailing lists, as that has a wider exposure than a ticket.
Generally, I would suggest using the Protobuf interface, rather than the
semi-deprecated JSON one.
I'd also like to point you to the phoenixdb native python client, which uses
protobuf, and that you could use as a direct template on how to implement a
native driver.
I don't know how good Perl protobuf support is, but if you can make it work, it
will result in a better client.
for example https://metacpan.org/pod/Google::ProtocolBuffers::Dynamic looks
promising.
bq. Did I understand correctly that the request is not valid in your opinion
due to the fact that the field has_parameter_values should not be specified if
there are no parameters?
Avatica primarily expects its own client to generate the requests, and that
doesn't have this problem.
I'd expect that you already know when you generate the JSON whether you have
parameters or not, so you can add the parameter conditionally.
Having said that, this CAN be considered a bug, and is probably not hard to
fix, so by all means open an Avatica ticket for this.
Note that even if it's fixed, it's likely going to take several months until an
official Avatica release is made, and new PQS release incorporates it, so if
you want this to work without patching and building your own Avatica + PQS,
then you'd better work around this in the meantime.
was (Author: stoty):
Am I right to assume that you are writing a native perl client for Avatica /
PQS?
You may want to discuss that on either or both of the Avatica and Phoenix
mailing lists, as that has a wider exposure than a ticket.
Generally, I would suggest using the Protobuf interface, rather than the
semi-deprecated JSON one.
I'd also like to point you to the phoenixdb native python client, which uses
protobuf, and that you could use as a direct template on how to implement a
native driver.
I don't know how good Perl protobuf support is, but if you can make it work, it
will result in a better client.
for example https://metacpan.org/pod/Google::ProtocolBuffers::Dynamic looks
promising.
bq. Did I understand correctly that the request is not valid in your opinion
due to the fact that the field has_parameter_values should not be specified if
there are no parameters?
Avatica primarily expects its own client to generate the requests, and that
doesn't have this problem.
I'd expect that you already know when you generate the JSON whether you have
parameters or not, so you can add the parameter conditionally.
Having said that, this CAN be considered a bug, and is probably not hard to
fix, so by all means open an Avatica ticket for this.
Note that even if it's fixed, it's likely going to take several months until an
official Avatica release is made, and new PQS release incorporates it, so if
you want this to work without patching and building your own Avatica + PQS,
then you'd better work around this in the meantime.
Istvan
> NullPointerException when send ExectuteRequest via protobuf with no parameters
> ------------------------------------------------------------------------------
>
> Key: PHOENIX-6602
> URL: https://issues.apache.org/jira/browse/PHOENIX-6602
> Project: Phoenix
> Issue Type: Bug
> Components: queryserver
> Affects Versions: queryserver-6.0.0
> Environment:
> Reporter: Aleksey Stavrov
> Priority: Major
>
> ExecuteRequest has following format:
> {noformat}
> message ExecuteRequest {
> StatementHandle statementHandle = 1;
> repeated TypedValue parameter_values = 2;
> uint64 deprecated_first_frame_max_size = 3;
> bool has_parameter_values = 4;
> int32 first_frame_max_size = 5;
> }
> {noformat}
> When i try to set *_has_parameter_values_* to _*false*_ and set 0 parameters
> then i get error:
> {noformat}
> 'protocol' => {
> 'severity' => 0,
> 'exceptions' => [
> 'java.lang.NullPointerException
> at
> org.apache.calcite.avatica.MetaImpl.checkParameterValueHasNull(MetaImpl.java:1633)
> at org.apache.calcite.avatica.jdbc.JdbcMeta.execute(JdbcMeta.java:849)
> at
> org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:260)
> at
> org.apache.calcite.avatica.remote.Service$ExecuteRequest.accept(Service.java:1056)
> at
> org.apache.calcite.avatica.remote.Service$ExecuteRequest.accept(Service.java:1026)
> 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:134)
> at
> org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:59)
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at org.eclipse.jetty.server.Server.handle(Server.java:501)
> at
> org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
> at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556)
> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
> at
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
> at
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
> at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
> at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
> at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
> at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
> at
> org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
> at
> org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
> at java.lang.Thread.run(Thread.java:748)
> '],
> 'message' => 'NullPointerException: (null exception message)',
> 'sql_state' => '00000',
> 'error_code' => 4294967295
> }
> {noformat}
> It work well when *_parameter_values_* is not empty list.
> Perhaps it was necessary to create issue in calcite avatica project, but I
> decided to try it here, since I still use queryserver.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)