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

SQL request to Avatica-Go returns 0s for float types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • 1.35.0
    • None
    • None

    Description

      I have zeros for float types in Go client result set with Calcite 1.35 update in Apache Druid. It worked with an older version. From what I see in the debugger TypedValue.NumberValue = 0 but DoubleValue = 1. Not sure where's the bug exactly - Druid/Avatica.

      This is how it can be reproduced:

      package main
      
      import (
        "database/sql"
        "fmt"
      
        _ "github.com/apache/calcite-avatica-go/v5"
      )
      
      func main() {
      
        jdbcUrl := "https://localhost/druid/v2/sql/avatica-protobuf"
      
        db, err := sql.Open("avatica", jdbcUrl)
        if err != nil {
          panic(err)
        }
        defer db.Close()
      
        sql4 := `
        SELECT
        cast(1.0 as double) m3
        `
      
        rows, err := db.Query(sql4)
        if err != nil {
          panic(err)
        }
        defer rows.Close()
      
        var m1 float32
      
        for rows.Next() {
          err := rows.Scan(&m1)
          if err != nil {
            panic(err)
          }
          fmt.Println(m1)
        }
      } 

      What I see in the debugger right now:

      This is what I see in the Druid debugger:

      Attachments

        1. image-2023-11-11-20-42-55-846.png
          270 kB
          Egor Ryashin
        2. image-2023-11-11-20-43-33-198.png
          891 kB
          Egor Ryashin
        3. image-2023-11-11-20-43-49-485.png
          288 kB
          Egor Ryashin
        4. image-2023-11-12-10-56-10-382.png
          166 kB
          Egor Ryashin
        5. image-2023-11-13-12-03-43-954.png
          568 kB
          Egor Ryashin

        Activity

          People

            francischuang Francis Chuang
            egrs Egor Ryashin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: