@@ -37,6 +37,8 @@ type RecordReader interface {
3737 Schema () * arrow.Schema
3838
3939 Next () bool
40+ RecordBatch () arrow.RecordBatch
41+ // Deprecated: Use [RecordBatch] instead.
4042 Record () arrow.Record
4143 Err () error
4244}
@@ -46,12 +48,12 @@ type simpleRecords struct {
4648 refCount atomic.Int64
4749
4850 schema * arrow.Schema
49- recs []arrow.Record
50- cur arrow.Record
51+ recs []arrow.RecordBatch
52+ cur arrow.RecordBatch
5153}
5254
5355// NewRecordReader returns a simple iterator over the given slice of records.
54- func NewRecordReader (schema * arrow.Schema , recs []arrow.Record ) (RecordReader , error ) {
56+ func NewRecordReader (schema * arrow.Schema , recs []arrow.RecordBatch ) (RecordReader , error ) {
5557 rs := & simpleRecords {
5658 schema : schema ,
5759 recs : recs ,
@@ -96,8 +98,11 @@ func (rs *simpleRecords) Release() {
9698 }
9799}
98100
99- func (rs * simpleRecords ) Schema () * arrow.Schema { return rs .schema }
100- func (rs * simpleRecords ) Record () arrow.Record { return rs .cur }
101+ func (rs * simpleRecords ) Schema () * arrow.Schema { return rs .schema }
102+ func (rs * simpleRecords ) RecordBatch () arrow.RecordBatch { return rs .cur }
103+
104+ // Deprecated: Use [RecordBatch] instead.
105+ func (rs * simpleRecords ) Record () arrow.Record { return rs .RecordBatch () }
101106func (rs * simpleRecords ) Next () bool {
102107 if len (rs .recs ) == 0 {
103108 return false
@@ -121,11 +126,11 @@ type simpleRecord struct {
121126 arrs []arrow.Array
122127}
123128
124- // NewRecord returns a basic, non-lazy in-memory record batch.
129+ // NewRecordBatch returns a basic, non-lazy in-memory record batch.
125130//
126- // NewRecord panics if the columns and schema are inconsistent.
127- // NewRecord panics if rows is larger than the height of the columns.
128- func NewRecord (schema * arrow.Schema , cols []arrow.Array , nrows int64 ) arrow.Record {
131+ // NewRecordBatch panics if the columns and schema are inconsistent.
132+ // NewRecordBatch panics if rows is larger than the height of the columns.
133+ func NewRecordBatch (schema * arrow.Schema , cols []arrow.Array , nrows int64 ) arrow.RecordBatch {
129134 rec := & simpleRecord {
130135 schema : schema ,
131136 rows : nrows ,
@@ -156,7 +161,12 @@ func NewRecord(schema *arrow.Schema, cols []arrow.Array, nrows int64) arrow.Reco
156161 return rec
157162}
158163
159- func (rec * simpleRecord ) SetColumn (i int , arr arrow.Array ) (arrow.Record , error ) {
164+ // Deprecated: Use [NewRecordBatch] instead.
165+ func NewRecord (schema * arrow.Schema , cols []arrow.Array , nrows int64 ) arrow.Record {
166+ return NewRecordBatch (schema , cols , nrows )
167+ }
168+
169+ func (rec * simpleRecord ) SetColumn (i int , arr arrow.Array ) (arrow.RecordBatch , error ) {
160170 if i < 0 || i >= len (rec .arrs ) {
161171 return nil , fmt .Errorf ("arrow/array: column index out of range [0, %d): got=%d" , len (rec .arrs ), i )
162172 }
@@ -179,7 +189,7 @@ func (rec *simpleRecord) SetColumn(i int, arr arrow.Array) (arrow.Record, error)
179189 copy (arrs , rec .arrs )
180190 arrs [i ] = arr
181191
182- return NewRecord (rec .schema , arrs , rec .rows ), nil
192+ return NewRecordBatch (rec .schema , arrs , rec .rows ), nil
183193}
184194
185195func (rec * simpleRecord ) validate () error {
@@ -242,7 +252,7 @@ func (rec *simpleRecord) ColumnName(i int) string { return rec.schema.Field(i).
242252//
243253// NewSlice panics if the slice is outside the valid range of the record array.
244254// NewSlice panics if j < i.
245- func (rec * simpleRecord ) NewSlice (i , j int64 ) arrow.Record {
255+ func (rec * simpleRecord ) NewSlice (i , j int64 ) arrow.RecordBatch {
246256 arrs := make ([]arrow.Array , len (rec .arrs ))
247257 for ii , arr := range rec .arrs {
248258 arrs [ii ] = NewSlice (arr , i , j )
@@ -252,7 +262,7 @@ func (rec *simpleRecord) NewSlice(i, j int64) arrow.Record {
252262 arr .Release ()
253263 }
254264 }()
255- return NewRecord (rec .schema , arrs , j - i )
265+ return NewRecordBatch (rec .schema , arrs , j - i )
256266}
257267
258268func (rec * simpleRecord ) String () string {
@@ -325,13 +335,13 @@ func (b *RecordBuilder) Reserve(size int) {
325335 }
326336}
327337
328- // NewRecord creates a new record from the memory buffers and resets the
329- // RecordBuilder so it can be used to build a new record.
338+ // NewRecordBatch creates a new record batch from the memory buffers and resets the
339+ // RecordBuilder so it can be used to build a new record batch .
330340//
331- // The returned Record must be Release()'d after use.
341+ // The returned RecordBatch must be Release()'d after use.
332342//
333- // NewRecord panics if the fields' builder do not have the same length.
334- func (b * RecordBuilder ) NewRecord () arrow.Record {
343+ // NewRecordBatch panics if the fields' builder do not have the same length.
344+ func (b * RecordBuilder ) NewRecordBatch () arrow.RecordBatch {
335345 cols := make ([]arrow.Array , len (b .fields ))
336346 rows := int64 (0 )
337347
@@ -353,7 +363,12 @@ func (b *RecordBuilder) NewRecord() arrow.Record {
353363 rows = irow
354364 }
355365
356- return NewRecord (b .schema , cols , rows )
366+ return NewRecordBatch (b .schema , cols , rows )
367+ }
368+
369+ // Deprecated: Use [NewRecordBatch] instead.
370+ func (b * RecordBuilder ) NewRecord () arrow.Record {
371+ return b .NewRecordBatch ()
357372}
358373
359374// UnmarshalJSON for record builder will read in a single object and add the values
@@ -411,9 +426,9 @@ type iterReader struct {
411426 refCount atomic.Int64
412427
413428 schema * arrow.Schema
414- cur arrow.Record
429+ cur arrow.RecordBatch
415430
416- next func () (arrow.Record , error , bool )
431+ next func () (arrow.RecordBatch , error , bool )
417432 stop func ()
418433
419434 err error
@@ -434,7 +449,10 @@ func (ir *iterReader) Release() {
434449 }
435450}
436451
437- func (ir * iterReader ) Record () arrow.Record { return ir .cur }
452+ func (ir * iterReader ) RecordBatch () arrow.RecordBatch { return ir .cur }
453+
454+ // Deprecated: Use [RecordBatch] instead.
455+ func (ir * iterReader ) Record () arrow.Record { return ir .RecordBatch () }
438456func (ir * iterReader ) Err () error { return ir .err }
439457
440458func (ir * iterReader ) Next () bool {
@@ -452,9 +470,9 @@ func (ir *iterReader) Next() bool {
452470 return ok
453471}
454472
455- // ReaderFromIter wraps a go iterator for arrow.Record + error into a RecordReader
473+ // ReaderFromIter wraps a go iterator for arrow.RecordBatch + error into a RecordReader
456474// interface object for ease of use.
457- func ReaderFromIter (schema * arrow.Schema , itr iter.Seq2 [arrow.Record , error ]) RecordReader {
475+ func ReaderFromIter (schema * arrow.Schema , itr iter.Seq2 [arrow.RecordBatch , error ]) RecordReader {
458476 next , stop := iter .Pull2 (itr )
459477 rdr := & iterReader {
460478 schema : schema ,
@@ -469,12 +487,12 @@ func ReaderFromIter(schema *arrow.Schema, itr iter.Seq2[arrow.Record, error]) Re
469487// you can use range on. The semantics are still important, if a record
470488// that is returned is desired to be utilized beyond the scope of an iteration
471489// then Retain must be called on it.
472- func IterFromReader (rdr RecordReader ) iter.Seq2 [arrow.Record , error ] {
490+ func IterFromReader (rdr RecordReader ) iter.Seq2 [arrow.RecordBatch , error ] {
473491 rdr .Retain ()
474492 return func (yield func (arrow.RecordBatch , error ) bool ) {
475493 defer rdr .Release ()
476494 for rdr .Next () {
477- if ! yield (rdr .Record (), nil ) {
495+ if ! yield (rdr .RecordBatch (), nil ) {
478496 return
479497 }
480498 }
@@ -486,6 +504,6 @@ func IterFromReader(rdr RecordReader) iter.Seq2[arrow.Record, error] {
486504}
487505
488506var (
489- _ arrow.Record = (* simpleRecord )(nil )
490- _ RecordReader = (* simpleRecords )(nil )
507+ _ arrow.RecordBatch = (* simpleRecord )(nil )
508+ _ RecordReader = (* simpleRecords )(nil )
491509)
0 commit comments