miguelpragier opened a new issue, #39238:
URL: https://github.com/apache/arrow/issues/39238
### Describe the bug, including details regarding any error messages,
version, and platform.
# Description
When having an empty resultset, the driver tries to include an empty record
referece, that cannot be scanned.
So, any operation that relies on the returned ***Rows** will trigger a
_"Index out of Range"_ error.
### We wrote a patch that prevents empty records to be appended to the
resultset.
### Further Details
The error is detected here, when r.currentRecord is mistankely 1, when
should be zero:
At: `/flight/flightsql/driver/driver.go:87`
```golang
func (r *Rows) Next(dest []driver.Value) error {
if r.currentRecord >= len(r.records) {
return io.EOF
}
record := r.records[r.currentRecord]
if int64(r.currentRow) >= record.NumRows() { // IS TRIGGERED HERE
return ErrOutOfRange
}
```
But happens here:
At: `/flight/flightsql/driver/driver.go:492`
```golang
for reader.Next() {
record := reader.Record()
record.Retain()
records = append(records, record) // BUT HAPPENS HERE
}
```
### Platform, Arrow/Flight & Go
OS: Linux
Arrow Driver: github.com/apache/arrow/go/v14/arrow/flight/flightsql/driver
Go Version: go1.21.4 linux/amd64
### 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]