Presto Query got Empty Result
flyfy1 opened this issue · comments
Song Yangyu commented
Example Code:
prestoConfig := presto.Config{
PrestoURI: "https://username:password@datagateway.url:443",
Source: "",
Catalog: "hive",
Schema: "public",
SessionProperties: nil,
CustomClientName: "",
KerberosEnabled: "",
KerberosKeytabPath: "",
KerberosPrincipal: "",
KerberosRealm: "",
KerberosConfigPath: "",
SSLCertPath: "/tmp/certs/datagateway_cert.pem",
}
dsn, err := prestoConfig.FormatDSN()
helper.Check(err)
fmt.Println("Going to call with DSN: ", dsn)
db, err := sql.Open("presto", dsn)
helper.Check(err)
ctx := context.Background()
conn, err := db.Conn(ctx)
helper.Check(err)
groupID := 129565
rows, err := conn.QueryContext(ctx, "SELECT driver_id, updated_at FROM public.driver_groups_drivers WHERE driver_group_id = " + strconv.Itoa(groupID) + " AND deleted_at IS NULL")
helper.Check(err)
result := make([]int64, 0, 1000)
for rows.NextResultSet() {
fmt.Println("Got next result set")
for rows.Next() {
fmt.Println("Loading record...")
var daxID int64
var updatedAt time.Time
rows.Scan(&daxID, &updatedAt)
result = append(result, daxID)
}
}
err = rows.Close()
helper.Check(err)
fmt.Println("Results: ", result)
What I Get
Empty Result
What I Expect
the query result with data
Song Yangyu commented
Closing this issue because I found that it's due to implementation of our own presto server -- it's not responding 503 when the result isn't ready yet