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 ¶
- type Source
- func (s *Source) Caps() plan.Caps
- func (s *Source) Describe() string
- func (s *Source) EstimatedRows() (int64, bool)
- func (s *Source) Name() string
- func (s *Source) Open(_ context.Context, spec source.ScanSpec) (source.BatchSource, error)
- func (s *Source) Projections() [][]string
- func (s *Source) Schema(context.Context) (*dtype.Schema, error)
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 ¶
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 ¶
FromColumns builds a single-batch source from columns.
func (*Source) EstimatedRows ¶ added in v0.4.0
EstimatedRows is exact: the batches are all there.
func (*Source) Projections ¶
Projections returns the column lists this source has been opened with.