Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion arrow/flight/flightsql/example/sql_batch_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package example

import (
"database/sql"
"io"
"reflect"
"strconv"
"strings"
Expand Down Expand Up @@ -264,7 +265,7 @@ func (r *SqlBatchReader) Next() bool {

rows := 0
for rows < maxBatchSize && r.rows.Next() {
if err := r.rows.Scan(r.rowdest...); err != nil {
if err := r.rows.Scan(r.rowdest...); err != nil && err.Error() != io.EOF.Error() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh...it's quite weird that this can return EOF

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, it's something weird with the sqlite handler implementation. it shouldn't be returning EOF, which looks like it isn't even returning io.EOF and instead just returns the string "EOF" it's really weird.

// Not really useful except for testing Flight SQL clients
detail := wrapperspb.StringValue{Value: r.schema.String()}
if st, sterr := status.New(codes.Unknown, err.Error()).WithDetails(&detail); sterr != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ package example
import (
"context"
"database/sql"
"errors"
"io"
"strings"
"sync/atomic"

Expand Down Expand Up @@ -173,7 +175,9 @@ func (s *SqliteTablesSchemaBatchReader) Next() bool {
for rows.Next() {
if err := rows.Scan(&tableName, &name, &typ, &nn); err != nil {
rows.Close()
s.err = err
if err.Error() != io.EOF.Error() {
s.err = err
}
return false
}

Expand All @@ -186,7 +190,7 @@ func (s *SqliteTablesSchemaBatchReader) Next() bool {
}

rows.Close()
if rows.Err() != nil {
if rows.Err() != nil && !errors.Is(rows.Err(), io.EOF) {
s.err = rows.Err()
return false
}
Expand Down
4 changes: 3 additions & 1 deletion arrow/flight/record_batch_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ package flight

import (
"bytes"
"errors"
"fmt"
"io"
"sync/atomic"

"github.com/apache/arrow-go/v18/arrow"
Expand Down Expand Up @@ -256,7 +258,7 @@ func ConcatenateReaders(rdrs []array.RecordReader, ch chan<- StreamChunk) {
ch <- StreamChunk{Data: rec}
}
if e, ok := r.(haserr); ok {
if e.Err() != nil {
if e.Err() != nil && !errors.Is(e.Err(), io.EOF) {
ch <- StreamChunk{Err: e.Err()}
return
}
Expand Down
Loading