[
https://issues.apache.org/jira/browse/CALCITE-1209?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15266913#comment-15266913
]
Josh Elser commented on CALCITE-1209:
-------------------------------------
It looks like I might have already fixed this one in CALCITE-1103 (for
1.8.0-SNAPSHOT).
Specifically:
{code}
case BYTE_STRING:
+ byte[] bytes;
+ // Serial representation is b64. We don't need to do that for protobuf
+ if (o instanceof String) {
+ // Assume strings are already b64 encoded
+ bytes = ByteString.parseBase64((String) o);
+ } else {
+ bytes = (byte[]) o;
+ }
+ builder.setBytesValues(HBaseZeroCopyByteString.wrap(bytes));
+ return;
{code}
[~francischuang], any chance you can pull down a recent version of Avatica and
verify that the issue is fixed?
> Byte strings not being correctly decoded when sent to avatica using protocol
> buffers
> ------------------------------------------------------------------------------------
>
> Key: CALCITE-1209
> URL: https://issues.apache.org/jira/browse/CALCITE-1209
> Project: Calcite
> Issue Type: Bug
> Components: avatica
> Affects Versions: avatica-1.7.1
> Reporter: Francis Chuang
> Assignee: Josh Elser
> Priority: Blocker
> Fix For: avatica-1.8.0
>
>
> When sending a typed value as a byte string to avatica using protocol
> buffers, it does not accept the bytes as an array of raw bytes in the
> {{bytes_values}} field.
> To work around it, the data needs to be first base64 encoded and then sent in
> the {{string_value}} field.
> This is the decoded protocol buffer being sent by the thin client:
> {code}
> 1: "org.apache.calcite.avatica.proto.Requests$ExecuteRequest"
> 2 {
> 1 {
> 1: "5141356e-f331-48c9-9d01-d71176ad92e8"
> 2: 126
> 3 {
> 2: "UPSERT INTO PQS.INTEGER_TABLE VALUES(?, ?)"
> 3 {
> 4: 4
> 5: "INTEGER"
> 6: "java.lang.Integer"
> 7: "?1"
> }
> 3 {
> 4: 4294967293
> 5: "VARBINARY"
> 6: "[B"
> 7: "?2"
> }
> 4 {
> 1: 4
> }
> }
> }
> 2 {
> 1: 12
> 4: 2
> }
> 2 {
> 1: 20
> // Data sent in string_value and base64 encoded
> 3: "iVBORw0KGgoAAAANSUhEUgAABmIAAAiwCAYAAAAvCT8OAAAACXBI..."
> }
> 3: 100
> 4: 1
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)