Egor Ryashin created CALCITE-6108:
-------------------------------------

             Summary: SQL request to Avatica-Go returns 0s for float types
                 Key: CALCITE-6108
                 URL: https://issues.apache.org/jira/browse/CALCITE-6108
             Project: Calcite
          Issue Type: Bug
          Components: avatica, avatica-go, druid-adapter
    Affects Versions: 1.35.0
            Reporter: Egor Ryashin
            Assignee: Francis Chuang
         Attachments: image-2023-11-11-20-42-55-846.png, 
image-2023-11-11-20-43-33-198.png, image-2023-11-11-20-43-49-485.png

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:
{code:java}
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)
  }
} {code}
What I see in the debugger right now:

!image-2023-11-11-20-43-49-485.png!

This is what I see in the Druid debugger:

!image-2023-11-11-20-42-55-846.png!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to