Help us shape the future of Go! Take the 2026 Go Developer Survey

arrowsrc

package
v0.6.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package arrowsrc scans a stream of Arrow records: an IPC stream, a Flight response, a C Data Interface stream — anything that is an array.RecordReader.

A factory, not a reader

A source is opened more than once: once to learn the schema when a query is planned, and once per scan per execution — a self-join scans it twice in one query, and a LazyFrame can be collected again. A RecordReader cannot be rewound. So the source holds a function that returns a fresh, independent reader every time, which is the rule ScanCSVReader states for byte streams.

Copied a window at a time

A reader's record is valid only until its next Next, and a C Data record is freed through its producer on release. Each batch is copied out of the current record (see internal/arrowin), and the reader is not advanced until every row of that record has been copied — so nothing handed to the engine ever points into Arrow memory, and the reader's own contract holds without a Retain.

What the engine's calls cost

  • Schema opens a reader, reads its schema, and releases it — once per Source. Explain and CollectSchema stop there.
  • Open does no I/O at all. The reader is opened on the first Next, so a scan that is planned and then abandoned — the left side of a join whose right side failed to plan — never opens one, and has nothing to leak.
  • Close releases the reader. A blocking Next inside the reader cannot be interrupted by a context, so Close waits for it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source scans the readers a factory returns.

func New

func New(open func() (array.RecordReader, error)) *Source

New returns a source over the readers open returns. open must return a new, independent reader on every call.

func (*Source) Caps

func (s *Source) Caps() plan.Caps

Caps reports projection only. An Arrow stream carries no statistics a predicate could use, and the rows arrive already decoded.

func (*Source) Describe

func (s *Source) Describe() string

func (*Source) Name

func (s *Source) Name() string

func (*Source) Open

func (s *Source) Open(ctx context.Context, spec source.ScanSpec) (source.BatchSource, error)

func (*Source) Projections

func (s *Source) Projections() [][]string

Projections returns the column lists this source has been opened with.

func (*Source) RowsOnly added in v0.6.8

func (s *Source) RowsOnly(source.ScanSpec) bool

RowsOnly: a scan of no columns is its rows (step 370).

func (*Source) Schema

func (s *Source) Schema(ctx context.Context) (*dtype.Schema, error)

Schema opens one reader, converts its schema, and releases it. The result is cached; a cancelled context is not, so a retry with a live one still works.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL