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

Decimal data serialized as Double in Protocol Buffer API

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • avatica-1.7.1, avatica-1.7.0, 1.6.0, 1.5.0
    • avatica-1.8.0
    • avatica
    • HDP 2.3.4 with Phoenix 4.4 and Calcite 1.5

    Description

      Decimal data is serialized as TypedValue.double_value and loses precision.

      Decoded Wireshark capture

      select * from decimal_table
      [employee@centos7-ws test]$ protoc --decode_raw < test.pb
      1: "org.apache.calcite.avatica.proto.Responses$ExecuteResponse"
      2 {
        1 {
          1: "cf74c4e9-29bc-410a-b557-bf7a4965cbaf"
          2: 479389
          3: 1
          4 {
            1 {
              4: 1
              8: 255
              9: "KEYCOLUMN"
              10: "KEYCOLUMN"
              12: 255
              14: "DECIMAL_TABLE_38_6"
              16: 1
              19: "java.lang.String"
              20 {
                1: 12
                2: "VARCHAR"
                3: 21
              }
            }
            1 {
              1: 1
              4: 1
              6: 1
              7: 1
              8: 38
              9: "COLUMN1"
              10: "COLUMN1"
              12: 38
              13: 6
              14: "DECIMAL_TABLE_38_6"
              16: 1
              19: "java.math.BigDecimal"
              20 {
                1: 3
                2: "DECIMAL"
                3: 23
              }
            }
            2: "select * from decimal_table_38_6"
            4 {
              1: 4
            }
          }
          5 {
            2: 1
            3 {
              1 {
                1 {
                  1: 21
                  3: "ConversionTestKey"
                }
              }
              1 {
                1 {
                  1: 22
                  6: 0x3ffe666666666666
                }
              }
            }
            3 {
              1 {
                1 {
                  1: 21
                  3: "FractionalNumeric6"
                }
              }
              1 {
                1 {
                  1: 22
                  6: 0x40ba0a524af0bf1a
                }
              }
            }
            3 {
              1 {
                1 {
                  1: 21
                  3: "FractionalNumeric8"
                }
              }
              1 {
                1 {
                  1: 22
                  6: 0xbff1f9acffa7eb6c
                }
              }
            }
            3 {
              1 {
                1 {
                  1: 21
                  3: "Null"
                }
              }
              1 {
                1 {
                  1: 24
                }
              }
            }
            3 {
              1 {
                1 {
                  1: 21
                  3: "OnePlusFraction"
                }
              }
              1 {
                1 {
                  1: 22
                  6: 0x3ff000010c6f7a0b
                }
              }
            }
          }
          6: 18446744073709551615
          7 {
            1: "centos7-ws:8765"
          }
        }
        3 {
          1: "centos7-ws:8765"
        }
      }
      
      

      The column1 data is tagged with 6 which corresponds to double_value in the proto file.

      Attachments

        Issue Links

          Activity

            People

              elserj Josh Elser
              kliew Kevin Liew
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: