Skip to content

Commit 537b64c

Browse files
authored
fix(test): Slice rows properly when reading in tests (#1632)
We never actually required the read records to be a single-row ones, so we may as well slice them ourselves
1 parent f80c02b commit 537b64c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

plugin/plugin_read.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@ func (p *Plugin) readAll(ctx context.Context, table *schema.Table) ([]arrow.Reco
1818
// nolint:prealloc
1919
var records []arrow.Record
2020
for record := range ch {
21-
records = append(records, record)
21+
records = append(records, sliceToSingleRowRecord(record)...)
2222
}
2323

2424
return records, err
2525
}
26+
27+
func sliceToSingleRowRecord(record arrow.Record) []arrow.Record {
28+
result := make([]arrow.Record, record.NumRows())
29+
for i := int64(0); i < record.NumRows(); i++ {
30+
result[i] = record.NewSlice(i, i+1)
31+
}
32+
return result
33+
}

0 commit comments

Comments
 (0)