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

memsrc

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package memsrc is an in-memory scan source.

It is the source the walking skeleton runs against, and it is also the reference implementation of the source contract: anything a Parquet or CSV reader has to do, this does in fifty lines, so it doubles as the worked example for someone plugging in their own storage.

It honours projection pushdown, which is what lets the end-to-end test assert that the optimizer's decision actually reaches the reader rather than being undone by a trim operator above 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 is an in-memory table.

func FromBatch

func FromBatch(b *data.Batch) (*Source, error)

FromBatch builds a single-batch source preserving the batch's DECLARED schema.

Why this is not FromColumns

FromColumns derives nullability from the data — `Nullable: c.NullCount() > 0` — which is right when columns are all you have, and wrong when a schema already exists. Field.Nullable is "a static property of the schema, not a count of nulls actually present", so a nullable column that happens to hold no nulls (the ordinary result of a filter) would come back non-nullable, and every downstream join, aggregate and cast would reason from the wrong schema.

It also preserves the ROW COUNT. A batch may legitimately have rows and no columns — the result of selecting nothing — and NewBatch sets rows to zero when there are none to count, which is why NewBatchRows exists.

func FromColumns

func FromColumns(cols ...*data.Column) (*Source, error)

FromColumns builds a single-batch source from columns.

func New

func New(schema *dtype.Schema, batches ...*data.Batch) (*Source, error)

New builds a source from batches that all share a schema.

func (*Source) Caps

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

func (*Source) Describe

func (s *Source) Describe() string

func (*Source) EstimatedRows added in v0.4.0

func (s *Source) EstimatedRows() (int64, bool)

EstimatedRows is exact: the batches are all there.

func (*Source) Name

func (s *Source) Name() string

func (*Source) Open

func (*Source) Projections

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

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

func (*Source) Schema

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

Jump to

Keyboard shortcuts

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