powersj opened a new issue, #42145:
URL: https://github.com/apache/arrow/issues/42145
### Describe the bug, including details regarding any error messages,
version, and platform.
## Background
We have found that there is a difference between libraires when running the
same query. The Go library in this example seems to hide or prevent an internal
error from showing up. While the Python library throws an exception with the
error (which is what we expect).
Happy to provide the token I am using to aid in reproducing with the code
used below.
## Expected result
An error message from the client:
```
External error: Panic: internal error: entered unreachable code. gRPC client
debug context: UNKNOWN:Error received from peer ipv4:34.196.233.7:443
{created_time:"2024-06-13T09:01:48.010211097-06:00", grpc_status:13,
grpc_message:"Join Error (panic)\ncaused by\nExternal error: Panic: internal
error: entered unreachable code"}. Client context: OK
```
## Actual result
No rows or errors are returned making it seem like the query was correct,
but no data was found.
## Go code example
```go
package main
import (
"context"
"crypto/tls"
"encoding/json"
"fmt"
"github.com/apache/arrow/go/v17/arrow/flight"
"github.com/apache/arrow/go/v17/arrow/ipc"
"github.com/apache/arrow/go/v17/arrow/memory"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/metadata"
)
var (
token = ""
host = "us-east-1-1.aws.cloud2.influxdata.com"
port = "443"
database = "test"
language = "sql"
query = `
SELECT array_to_string(array_agg(instance),',')
FROM (
SELECT DISTINCT instance
FROM repro
WHERE time >= now() - INTERVAL '1 hours'
)`
)
func main() {
ticketJSON, err := json.Marshal(map[string]interface{}{
"database": database,
"sql_query": query,
"query_type": language,
})
if err != nil {
panic(fmt.Errorf("unable to serialize ticket data to JSON: %w",
err))
}
ticket := &flight.Ticket{Ticket: ticketJSON}
opts := []grpc.DialOption{
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),
}
client, err := flight.NewClientWithMiddleware(fmt.Sprintf("%s:%s",
host, port), nil, nil, opts...)
if err != nil {
panic(fmt.Errorf("unable to create flight client: %w", err))
}
ctx := metadata.AppendToOutgoingContext(context.Background(),
"authorization", "Bearer "+token)
stream, err := client.DoGet(ctx, ticket)
if err != nil {
panic(fmt.Errorf("failed calling client: %w", err))
}
reader, err := flight.NewRecordReader(stream,
ipc.WithAllocator(memory.DefaultAllocator))
if err != nil {
panic(fmt.Errorf("unable to get flight reader: %w", err))
}
for reader.Next() {
fmt.Println(reader.Record())
}
reader.Release()
fmt.Println("Query executed successfully!")
}
```
outputs:
```s
❯ go run .
Query executed successfully!
```
## Python code example
```py3
#!/usr/bin/env python3
import json
from pyarrow.flight import FlightClient, Ticket, FlightCallOptions
token=""
host="us-east-1-1.aws.cloud2.influxdata.com"
port=443
database="test"
language = "sql"
query = """
SELECT array_to_string(array_agg(instance),',')
FROM (
SELECT DISTINCT instance
FROM repro
WHERE time >= now() - INTERVAL '1 hours'
)
"""
flight_client = FlightClient(f"grpc+tls://{host}:{port}")
opts = {
"headers": [(b"authorization", f"Bearer {token}".encode('utf-8'))],
"timeout": 300
}
options = FlightCallOptions(**opts)
ticket_data = {
"database": database,
"sql_query": query,
"query_type": language
}
ticket = Ticket(json.dumps(ticket_data).encode('utf-8'))
flight_reader = flight_client.do_get(ticket, options)
flight_reader.read_all()
```
outputs:
```s
❯ ./query.py
Traceback (most recent call last):
File "/home/powersj/influxdb-client-tools/python/v3/./query.py", line 37,
in <module>
flight_reader.read_all()
File "pyarrow/_flight.pyx", line 1075, in
pyarrow._flight.FlightStreamReader.read_all
File "pyarrow/_flight.pyx", line 1078, in
pyarrow._flight.FlightStreamReader.read_all
File "pyarrow/_flight.pyx", line 55, in pyarrow._flight.check_flight_status
pyarrow._flight.FlightInternalError: Flight returned internal error, with
message: Join Error (panic)
caused by
External error: Panic: internal error: entered unreachable code. gRPC client
debug context: UNKNOWN:Error received from peer ipv4:34.196.233.7:443
{created_time:"2024-06-13T09:25:46.298673099-06:00", grpc_status:13,
grpc_message:"Join Error (panic)\ncaused by\nExternal error: Panic: internal
error: entered unreachable code"}. Client context: OK
```
### Component(s)
Go
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]