Skip to content

Commit 146f999

Browse files
authored
ci: make additional checks to prevent flaky EOF (#414)
### Rationale for this change Additional checks for `io.EOF` to avoid flaky tests
1 parent 2e57003 commit 146f999

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

arrow/flight/flightsql/example/sql_batch_reader.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package example
2121

2222
import (
2323
"database/sql"
24+
"io"
2425
"reflect"
2526
"strconv"
2627
"strings"
@@ -264,7 +265,7 @@ func (r *SqlBatchReader) Next() bool {
264265

265266
rows := 0
266267
for rows < maxBatchSize && r.rows.Next() {
267-
if err := r.rows.Scan(r.rowdest...); err != nil {
268+
if err := r.rows.Scan(r.rowdest...); err != nil && err.Error() != io.EOF.Error() {
268269
// Not really useful except for testing Flight SQL clients
269270
detail := wrapperspb.StringValue{Value: r.schema.String()}
270271
if st, sterr := status.New(codes.Unknown, err.Error()).WithDetails(&detail); sterr != nil {

arrow/flight/flightsql/example/sqlite_tables_schema_batch_reader.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ package example
2222
import (
2323
"context"
2424
"database/sql"
25+
"errors"
26+
"io"
2527
"strings"
2628
"sync/atomic"
2729

@@ -173,7 +175,9 @@ func (s *SqliteTablesSchemaBatchReader) Next() bool {
173175
for rows.Next() {
174176
if err := rows.Scan(&tableName, &name, &typ, &nn); err != nil {
175177
rows.Close()
176-
s.err = err
178+
if err.Error() != io.EOF.Error() {
179+
s.err = err
180+
}
177181
return false
178182
}
179183

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

188192
rows.Close()
189-
if rows.Err() != nil {
193+
if rows.Err() != nil && !errors.Is(rows.Err(), io.EOF) {
190194
s.err = rows.Err()
191195
return false
192196
}

arrow/flight/record_batch_reader.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ package flight
1818

1919
import (
2020
"bytes"
21+
"errors"
2122
"fmt"
23+
"io"
2224
"sync/atomic"
2325

2426
"github.com/apache/arrow-go/v18/arrow"
@@ -256,7 +258,7 @@ func ConcatenateReaders(rdrs []array.RecordReader, ch chan<- StreamChunk) {
256258
ch <- StreamChunk{Data: rec}
257259
}
258260
if e, ok := r.(haserr); ok {
259-
if e.Err() != nil {
261+
if e.Err() != nil && !errors.Is(e.Err(), io.EOF) {
260262
ch <- StreamChunk{Err: e.Err()}
261263
return
262264
}

0 commit comments

Comments
 (0)