Documentation
¶
Overview ¶
Package streamreader adapts a native ArrowArrayStream to an Arrow RecordReader with reference-counted ownership.
The root blob readers and the raw-file readers both consume ffi.StreamReader. They differ only in how a stream failure is classified for their public package, so the lifetime, context and batch-borrowing rules live here once and the caller supplies the error mapping.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is an array.RecordReader over a Source. A batch returned by Next is borrowed: the next Next call or Release releases it, so call Retain to keep it. The context passed to NewReader is checked before every read.
wrap classifies source failures for the public package. It is called once per source error and stored as Err. Context errors are returned unchanged.
func NewReader ¶
func NewReader(ctx context.Context, source Source, schema *arrow.Schema, wrap func(error) error) *Reader
NewReader takes ownership of source. The caller must not use source after the returned reader is released. A nil ctx uses context.Background; a nil wrap returns source errors unchanged.
func (*Reader) Next ¶
Next advances to the next batch. It reports false at the end of the stream, after a context or source error, or after the last reference was released.
func (*Reader) RecordBatch ¶
func (r *Reader) RecordBatch() arrow.RecordBatch
RecordBatch returns the current borrowed batch.
type Source ¶
type Source interface {
// Next returns the next owned batch. A false return with a nil error marks
// the end of the stream.
Next() (arrow.RecordBatch, bool, error)
// Close releases the native stream.
Close()
}
Source is the native Arrow stream a Reader drains. *ffi.StreamReader implements it. Close releases the native stream exactly once; batches that were already returned stay valid.