Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1209

Byte strings not being correctly decoded when sent to avatica using protocol buffers

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • avatica-1.7.1
    • avatica-1.8.0
    • avatica
    • None

    Description

      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:

      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
      }
      

      Attachments

        Issue Links

          Activity

            People

              elserj Josh Elser
              francischuang Francis Chuang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: