miguelpragier commented on code in PR #40090: URL: https://github.com/apache/arrow/pull/40090#discussion_r1492341426
########## go/arrow/flight/flightsql/driver/driver.go: ########## @@ -79,28 +96,37 @@ func (r *Rows) Close() error { // should be taken when closing Rows not to modify // a buffer held in dest. func (r *Rows) Next(dest []driver.Value) error { - if r.currentRecord >= len(r.records) { - return io.EOF - } - record := r.records[r.currentRecord] + if r.currentRecord == nil || int64(r.currentRow) >= r.currentRecord.NumRows() { + if r.streamError != nil { + return r.streamError + } + + r.releaseRecord() - if int64(r.currentRow) >= record.NumRows() { - return ErrOutOfRange + // Get the next record from the channel + var ok bool + if r.currentRecord, ok = <-r.recordChan; !ok { + return io.EOF // Channel closed, no more records + } + + r.currentRow = 0 + + // safety double-check + if r.currentRecord == nil || int64(r.currentRow) >= r.currentRecord.NumRows() { + return io.EOF // Channel closed, no more records + } } - for i, arr := range record.Columns() { - v, err := fromArrowType(arr, r.currentRow) + for i, col := range r.currentRecord.Columns() { + v, err := fromArrowType(col, int(r.currentRow)) if err != nil { return err } + dest[i] = v } Review Comment: deal. mutex removed. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org