Francis Chuang created CALCITE-1209:
---------------------------------------

             Summary: 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


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)

Reply via email to