You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This a copy of the issue originally reported in Go v2 client
Specifications
Client Version: 0.5.0
InfluxDB Version: 3.0 Serverless
Apache Arrow Go Version: 13.0.0
Code sample to reproduce problem
Run the code below, substituting in bucket credentials for a bucket containing a large dataset, and use a query that will take a few seconds to run.
After a few seconds, before the query completes, switch off internet connectivity.
package main
import (
"context""encoding/csv""fmt""log""os""strings""time"
influx "github.com/InfluxCommunity/influxdb3-go/influxdb3""github.com/apache/arrow/go/v13/arrow"
)
funcmain() {
vardatabasestringvartokenstringvarquerystringvarlanguagestringvarresolutionstringcurrentTime:=time.Now()
database="databaseID"token="databaseReadToken"query=`SELECT * FROM "queryTest" WHERE time >= 1708819200000ms and time <= 1709023793000ms ORDER BY time DESC`language="influxql"resolution="ms"url:="databaseURL"// Create a new client using an InfluxDB server base URL and an authentication tokenclient, err:=influx.New(influx.ClientConfig{
Host: url,
Token: token,
Database: database,
})
iferr!=nil {
log.Fatal(err)
}
// Close client at the end and escalate error if presentdeferfunc(client*influx.Client) {
err:=client.Close()
iferr!=nil {
log.Fatal(err)
}
}(client)
queryType=influx.InfluxQLoptions:= influx.QueryOptions{QueryType: queryType}
iterator, err:=client.QueryWithOptions(context.Background(), &options, query)
iferr!=nil {
log.Fatal(err)
}
// Write data to file sectionvarheaderWritten=falsedateTimeString:=currentTime.Format("2006_01_02-15_04_05") // Example format: YYYY-MM-DD_HH-MM-SScsvFilePath:="query_"+dateTimeString+".csv"file, err:=os.Create(csvFilePath)
iferr!=nil {
log.Fatal(err)
}
deferfile.Close()
writer:=csv.NewWriter(file)
deferwriter.Flush()
varheader []stringforiterator.Next() {
// Iterate over query data row by rowmapData:=iterator.Value()
if!headerWritten {
forkey:=rangemapData {
header=append(header, key)
}
iferr:=writer.Write(header); err!=nil {
fmt.Println(csvFilePath)
log.Fatal(err)
}
headerWritten=true
}
// Create an empty slice of empty strings with the same length as the headervarrow []stringfori:=0; i<len(header); i++ {
row=append(row, "")
}
// Fill in the row slice with values based on the headerforcolIndex, col:=rangeheader {
// Retrieve the value from mapData if it existsifvalue, ok:=mapData[col]; ok {
ifcol=="time" {
switchresolution {
case"ms":
value=value.(arrow.Timestamp) /1e6case"us":
value=value.(arrow.Timestamp) /1e3
}
}
ifvalue==nil {
value=""
}
row[colIndex] =fmt.Sprintf("%v", value)
}
}
err:=writer.Write(row)
iferr!=nil {
fmt.Println(csvFilePath)
log.Fatal("Failed to write to CSV file, please re-run query")
}
}
writer.Flush() // Ensure data is flushed before the end in normal operationfmt.Println(csvFilePath)
}
Query used and screenshot of final field of CSV used to replicate bug:
SELECT * FROM "queryTest" WHERE time >= 1708819200000ms and time <= 1709023793000ms ORDER BY time DESC
Expected behavior
The script should produce a timeout error, or equivalent to inform the user that the connection was interrupted and the query wasn't completed. It should be similar to the behaviour from the Python InfluxDB3 library, which returns the error stack:
…
File "pyarrow\_flight.pyx", line 1081, 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: unexpected EOF.
…
Actual behavior
The script completes without any errors, and the CSV file should be in the script folder. Check the last timestamp in the CSV, and observe that it does not match the last requested timestamp from the query.
Note that this also occurs when attempting to query a very large amount of data (~500MB). The function hangs for a while before eventually returning, but on testing only a partial dataset was returned about 30% of the time.
Additional info
No response
The text was updated successfully, but these errors were encountered:
This a copy of the issue originally reported in Go v2 client
Specifications
Code sample to reproduce problem
Query used and screenshot of final field of CSV used to replicate bug:
SELECT * FROM "queryTest" WHERE time >= 1708819200000ms and time <= 1709023793000ms ORDER BY time DESC
Expected behavior
The script should produce a timeout error, or equivalent to inform the user that the connection was interrupted and the query wasn't completed. It should be similar to the behaviour from the Python InfluxDB3 library, which returns the error stack:
Actual behavior
The script completes without any errors, and the CSV file should be in the script folder. Check the last timestamp in the CSV, and observe that it does not match the last requested timestamp from the query.
Note that this also occurs when attempting to query a very large amount of data (~500MB). The function hangs for a while before eventually returning, but on testing only a partial dataset was returned about 30% of the time.
Additional info
No response
The text was updated successfully, but these errors were encountered: