golars

package module
v0.0.0-...-edd961b Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 7 Imported by: 0

README

Golars

A high-performance Arrow-native, Polars-like DataFrame API for Go.

If you know polars, you'll feel right at home. In fact, golars uses native polars under the hood.

go get github.com/guywaldman/golars

The package bundles native dependencies such that you can install it easily (as you would polars).
It exposes high-level DataFrame APIs, with "zero configuration" support (e.g., for reading from S3/GCS):

import gl "github.com/guywaldman/golars"

// ...
df, _ := gl.ReadParquet(ctx, "events.parquet")
summary, _ := df.GroupBy(gl.Col("country")).Agg(
	gl.Col("amount").Sum().Alias("amount_total"),
	gl.Col("user_id").Count().Alias("users"),
)
_ = summary.WriteCSV(ctx, "out.csv")

Note that you can read from local files as well as cloud storage (S3 with s3:// or Google Cloud Storage with gs://) using their default credential discovery, as Polars does. If you need to configure it (such as for auth), you can use:

store, err := gl.NewGCSStore(context.Background(), option.WithoutAuthentication())
if err != nil {
  panic(err)
}
defer store.Close()

if err := gl.RegisterObjectStore("gs", store); err != nil {
  panic(err)
}

// ...

Featureset

  • Arrow-backed DataFrame and Series, with retained Arrow interop.
  • Row-oriented constructors: DataFrameFromMaps and generic DataFrameFromStructs, with nullable missing fields and standard json tags.
  • Eager and lazy Select/SelectSeq, Filter, WithColumns/WithColumnsSeq, Limit/Head/Tail, Slice, Reverse, Clear, Sort, GroupBy(...).Agg(...), joins, window expressions, Unique, Explode, Unnest, Unpivot/Melt, fixed rolling expressions, as-of joins, Drop, Rename, DropNulls, and DropNaNs.
  • Expression trees with arithmetic (including modulo, powers, rounding, and trigonometric kernels), comparisons, boolean logic, null/NaN handling, casts, aggregates, conditional expressions, partitioned windows, descending sort, membership/range predicates, list expressions, and common string/date kernels.
  • Native JSON-column decoding into typed structs and lists, with SIMD parsing, row-level nulling for malformed JSON, field-level nulling for bad leaves, coercion controls, and strict required-field validation.
  • Struct field expressions such as Col("payload").Struct().Element("user_id"), including nested struct access.
  • Arrow type descriptors - primitive, temporal, decimal, dictionary (categorical/enum), nested list/struct/map, fixed-size, view, interval, and run-end encoded types. DataFrame/Series constructors accept Arrow arrays, chunked arrays, tables, and record batches without a copy at the boundary.
  • Lazy scans and eager reads for Parquet, CSV, NDJSON, JSON arrays, and Arrow IPC file/stream formats (with ScanArrow/ReadArrow aliases).
  • Scan projection and bounded reads, CSV delimiters, headers, comments, null markers, quote handling, and schema-inference controls.
  • Lazy and eager sinks for the same formats, with non-overwriting local-file defaults. LazyFrame.Sink selects the writer from the destination extension.
  • Row-oriented helpers: Rows materializes detached row maps, while ForEachRow streams them without retaining the complete result. ToDicts remains as a Polars-compatible alias.
  • Series value access with Values/ToSlice, zero-copy Slice, Clone, IsEmpty, and Arrow chunk metadata; DataFrames expose Columns, IsEmpty, Clone, and the corresponding row operations.
  • Local globbing and Hive-style Parquet partition discovery.
  • Hive dataset writes with Create/Append, partition columns, _SUCCESS, and _golars_schema.json.
  • Built-in S3 and GCS URI support using standard credential discovery. Custom ObjectStore implementations can override them with RegisterObjectStore or WithObjectStore.
  • Engine-wide memory accounting with a 1 GiB default quota and contextual cancellation through context.Context.

Native execution

All relational execution runs through the embedded Rust/Polars backend. The Go layer owns the public API, Arrow conversion, and storage adapters (including custom object stores and formats Polars does not open directly). The target-specific native library is embedded in the Go module and loaded with CGO-free FFI, so consumers only need the normal go get and Go build workflow. For object-store scans, the Go adapter preserves projected columns, simple Parquet predicates, row-group pruning, and bounded reads before handing Arrow batches to Polars.

The checked-in assets currently support Linux amd64/arm64 and macOS arm64. A target without an embedded asset returns an explicit native-backend availability error; there is no portable execution fallback.

Supported platforms

Operating system Architectures Native execution
Linux amd64, arm64 Supported and validated in CI
macOS arm64 Supported and validated in CI
Windows Not supported yet (#3)

The package can still be compiled on other Go targets, but collection returns an explicit native-backend availability error because no matching Polars library is embedded.

Fast JSON parsing

DecodeJSON turns a string expression into a typed Arrow value. You can provide an Arrow descriptor or derive the schema directly from a Go struct. Exported fields use standard json tags; pointer fields are nullable, and nested structs and lists are supported.

schema := gl.StructOf(
	gl.Field{Name: "id", Type: gl.Int64, Nullable: false},
	gl.Field{Name: "tenant", Type: gl.String, Nullable: true},
	gl.Field{Name: "tags", Type: gl.ListOf(gl.String), Nullable: true},
)

decoded := gl.DecodeJSON(gl.Col("payload_json"), schema)
result, err := lf.Select(decoded.Alias("payload")).Collect(ctx)

The struct form avoids a separate schema declaration:

type Payload struct {
	ID      int64    `json:"id"`
	Tenant  string   `json:"tenant"`
	Tags    []string `json:"tags"`
	Profile *struct {
		Country string `json:"country"`
	} `json:"profile"`
}

decoded := gl.DecodeJSON(gl.Col("payload_json"), Payload{})
// Or use gl.DecodeJSONAs[Payload](gl.Col("payload_json")).

Rows with malformed JSON or incompatible leaves become null by default, while valid sibling fields are retained. Use WithJSONCoerce(false) for strict JSON types, WithJSONErrorMode(JSONErrorOnError) to fail the query, or WithJSONStrictRequiredFields(true) to enforce non-nullable struct fields.

Examples

df, err := gl.ReadCSV(ctx, "events.csv")
if err != nil { return err }
defer df.Close()

summary, err := df.GroupBy(gl.Col("country")).Agg(
	gl.Col("amount").Sum().Alias("amount_total"),
	gl.Col("user_id").Count().Alias("users"),
)
if err != nil { return err }
defer summary.Close()

err = summary.WriteParquet(ctx, "out.parquet")

For an explicitly configured engine:

engine, err := gl.NewEngine(
	gl.WithMemoryLimit(512<<20),
	gl.WithBatchSize(32<<10),
	gl.WithObjectStore("s3", s3Store),
)
if err != nil { return err }
defer engine.Close()

df, err := engine.ScanParquet("s3://bucket/events/*.parquet").Collect(ctx)

The implementation is intentionally a fast-breaking v0 API. The execution kernel and format contracts are stable enough for experimentation, while the public type names and richer Polars parity surface will continue to grow.

Performance and Benchmarks

The benchmarks directory contains equivalent Go and Rust Polars workloads. The following run was captured on 2026-08-03 on a MacBook Pro with an Apple M3 Max (16 cores, 128 GB RAM), using Go 1.26.4, Rust 1.96.0, Polars 0.52.0, and 16 threads for both implementations. Each cell is golars / polars in milliseconds per execution, followed by the golars-to- polars ratio.

Each implementation had one unmeasured warmup and three measured executions. The Go side used -benchtime=3x; the Rust side used --warmup 1 --iterations 3.

Input Rows Projection Filter + Select Grouped Aggregation Window Aggregation Self Join
5K 0.592 / 0.349 (1.69x) 0.523 / 0.377 (1.39x) 0.925 / 0.867 (1.07x) 0.900 / 1.136 (0.79x) 2.157 / 1.913 (1.13x)
10K 0.731 / 0.406 (1.80x) 0.802 / 0.362 (2.22x) 0.902 / 0.812 (1.11x) 1.039 / 0.998 (1.04x) 2.330 / 1.541 (1.51x)
200K 1.061 / 0.771 (1.38x) 0.694 / 0.484 (1.43x) 1.365 / 1.296 (1.05x) 1.579 / 1.575 (1.00x) 2.400 / 1.749 (1.37x)
500K 1.658 / 1.176 (1.41x) 0.900 / 0.639 (1.41x) 1.745 / 1.655 (1.05x) 2.013 / 2.587 (0.78x) 3.164 / 2.794 (1.13x)
1M 2.093 / 1.729 (1.21x) 1.054 / 0.872 (1.21x) 2.417 / 2.299 (1.05x) 3.330 / 3.423 (0.97x) 3.457 / 3.102 (1.11x)
5M 5.248 / 5.349 (0.98x) 2.136 / 2.163 (0.99x) 5.463 / 4.763 (1.15x) 13.530 / 13.562 (1.00x) 9.485 / 8.038 (1.18x)

For the 1M-row dataset, the complete workload set was:

Workload golars ms/op polars ms/op ratio golars B/op polars RSS delta rows
projection_only 2.093 1.729 1.21x 2,322 36.2 MiB 1,000,000
filter_select 1.054 0.872 1.21x 3,586 6.2 MiB 500,000
compound_filter 1.056 0.843 1.25x 5,034 3.0 MiB 15,625
derived_projection 2.349 1.956 1.20x 7,194 30.5 MiB 500,000
grouped_aggregation 2.417 2.299 1.05x 4,178 26.0 MiB 128
multi_aggregation 3.191 3.169 1.01x 5,842 17.6 MiB 32
string_filter 1.807 1.830 0.99x 3,898 19.1 MiB 10,000
limit_pushdown 0.786 0.806 0.98x 4,642 2.8 MiB 1,000
sorted_topk 4.656 5.051 0.92x 5,682 13.0 MiB 100
window_aggregation 3.330 3.423 0.97x 6,186 13.0 MiB 500,000
self_join 3.457 3.102 1.11x 10,482 31.5 MiB 125,008
unique_tenant 4.404 4.757 0.93x 3,421 20.8 MiB 32
full_aggregation 5.106 5.341 0.96x 4,330 19.6 MiB 32
json_decode 41.711 52.246 0.80x 5,728 157.9 MiB 1,000,000

Go's B/op is the allocation metric reported by go test; the Polars column is the process RSS increase reported by the Rust runner, so those two memory figures are directional rather than directly interchangeable.

To reproduce this exact scale sweep with explicit thread parity:

GOMAXPROCS=16 POLARS_MAX_THREADS=16 \
GOLARS_BENCH_TIME=3x \
GOLARS_BENCH_POLARS_ITERATIONS=3 \
GOLARS_BENCH_WARMUP=1 \
./benchmarks/run.sh

Contributing

Feel very welcome to do so! See CONTRIBUTING.md.

Documentation

Overview

Package golars provides an Arrow-native, lazy DataFrame API for Go.

Index

Constants

View Source
const (
	// JSONNullOnError replaces malformed or incompatible rows with null.
	JSONNullOnError = core.JSONNullOnError
	// JSONErrorOnError returns the first row-level decoding error.
	JSONErrorOnError = core.JSONErrorOnError
)
View Source
const (
	// JoinInner keeps rows with matching keys from both inputs.
	JoinInner = core.JoinInner
	// JoinLeft keeps every row from the left input.
	JoinLeft = core.JoinLeft
	// JoinFull keeps every row from both inputs.
	JoinFull = core.JoinFull
	// JoinRight keeps every row from the right input.
	JoinRight = core.JoinRight
	// JoinSemi keeps left rows with a matching right key.
	JoinSemi = core.JoinSemi
	// JoinAnti keeps left rows without a matching right key.
	JoinAnti = core.JoinAnti
	// JoinCross computes the Cartesian product.
	JoinCross = core.JoinCross
)
View Source
const (
	// AsofBackward matches the last right key less than or equal to the left key.
	AsofBackward = core.AsofBackward
	// AsofForward matches the first right key greater than or equal to the left key.
	AsofForward = core.AsofForward
	// AsofNearest matches the closest right key.
	AsofNearest = core.AsofNearest
	// AsOfBackward is an alias for AsofBackward.
	AsOfBackward = core.AsOfBackward
	// AsOfForward is an alias for AsofForward.
	AsOfForward = core.AsOfForward
	// AsOfNearest is an alias for AsofNearest.
	AsOfNearest = core.AsOfNearest
)
View Source
const DefaultMemoryLimit int64 = core.DefaultMemoryLimit

DefaultMemoryLimit is the default per-engine memory quota in bytes.

Variables

View Source
var (
	// ErrClosed reports that a DataFrame, LazyFrame, Series, or Engine is closed.
	ErrClosed = core.ErrClosed
	// ErrColumnNotFound reports that an expression referenced an unknown column.
	ErrColumnNotFound = core.ErrColumnNotFound
	// ErrTypeMismatch reports an incompatible type operation.
	ErrTypeMismatch = core.ErrTypeMismatch
	// ErrInvalidPlan reports an invalid lazy or eager operation.
	ErrInvalidPlan = core.ErrInvalidPlan

	// Null is the Arrow null type.
	Null = core.Null
	// Boolean is the Arrow boolean type.
	Boolean = core.Boolean
	// Int8 is the signed 8-bit integer type.
	Int8 = core.Int8
	// Int16 is the signed 16-bit integer type.
	Int16 = core.Int16
	// Int32 is the signed 32-bit integer type.
	Int32 = core.Int32
	// Int64 is the signed 64-bit integer type.
	Int64 = core.Int64
	// Uint8 is the unsigned 8-bit integer type.
	Uint8 = core.Uint8
	// Uint16 is the unsigned 16-bit integer type.
	Uint16 = core.Uint16
	// Uint32 is the unsigned 32-bit integer type.
	Uint32 = core.Uint32
	// Uint64 is the unsigned 64-bit integer type.
	Uint64 = core.Uint64
	// UInt8 is an alias for Uint8.
	UInt8 = core.UInt8
	// UInt16 is an alias for Uint16.
	UInt16 = core.UInt16
	// UInt32 is an alias for Uint32.
	UInt32 = core.UInt32
	// UInt64 is an alias for Uint64.
	UInt64 = core.UInt64
	// Float32 is the 32-bit floating-point type.
	Float32 = core.Float32
	// Float64 is the 64-bit floating-point type.
	Float64 = core.Float64
	// Float16 is the 16-bit floating-point type.
	Float16 = core.Float16
	// String is the Arrow UTF-8 string type.
	String = core.String
	// LargeString is the 64-bit-offset UTF-8 string type.
	LargeString = core.LargeString
	// Binary is the variable-width binary type.
	Binary = core.Binary
	// LargeBinary is the 64-bit-offset binary type.
	LargeBinary = core.LargeBinary
	// StringView is the Arrow string-view type.
	StringView = core.StringView
	// BinaryView is the Arrow binary-view type.
	BinaryView = core.BinaryView
	// Date32 is a date stored as days since the epoch.
	Date32 = core.Date32
	// Date64 is a date stored as milliseconds since the epoch.
	Date64 = core.Date64
	// Date is an alias for Date32.
	Date = core.Date
	// Utf8 is an alias for String.
	Utf8 = core.Utf8
	// Categorical is an unordered dictionary type.
	Categorical = core.Categorical
	// Enum is an ordered dictionary type.
	Enum = core.Enum
	// IntervalMonth is a month interval type.
	IntervalMonth = core.IntervalMonth
	// IntervalDayTime is a day-time interval type.
	IntervalDayTime = core.IntervalDayTime
	// IntervalMonthDayNano is a month-day-nanosecond interval type.
	IntervalMonthDayNano = core.IntervalMonthDayNano
)

Functions

func RegisterObjectStore

func RegisterObjectStore(scheme string, store ObjectStore) error

RegisterObjectStore registers a process-wide object store for a URI scheme.

func WriteArrow

func WriteArrow(ctx context.Context, df *DataFrame, destination string, options ...WriteOption) error

WriteArrow writes a DataFrame as an Arrow IPC file.

func WriteCSV

func WriteCSV(ctx context.Context, df *DataFrame, destination string, options ...WriteOption) error

WriteCSV writes a DataFrame as CSV.

func WriteIPCFile

func WriteIPCFile(ctx context.Context, df *DataFrame, destination string, options ...WriteOption) error

WriteIPCFile writes a DataFrame as an Arrow IPC file.

func WriteIPCStream

func WriteIPCStream(ctx context.Context, df *DataFrame, destination string, options ...WriteOption) error

WriteIPCStream writes a DataFrame as an Arrow IPC stream.

func WriteJSON

func WriteJSON(ctx context.Context, df *DataFrame, destination string, options ...WriteOption) error

WriteJSON writes a DataFrame as a JSON array.

func WriteNDJSON

func WriteNDJSON(ctx context.Context, df *DataFrame, destination string, options ...WriteOption) error

WriteNDJSON writes a DataFrame as newline-delimited JSON.

func WriteParquet

func WriteParquet(ctx context.Context, df *DataFrame, destination string, options ...WriteOption) error

WriteParquet writes a DataFrame as Parquet.

func WriteParquetDataset

func WriteParquetDataset(ctx context.Context, df *DataFrame, destination string, options ...DatasetWriteOption) error

WriteParquetDataset writes a DataFrame as a partitioned Parquet dataset.

Types

type AsOfJoinOption

type AsOfJoinOption = core.AsOfJoinOption

AsOfJoinOption configures an as-of join.

func WithAsOfAllowExact

func WithAsOfAllowExact(enabled bool) AsOfJoinOption

WithAsOfAllowExact is an alias for WithAsofAllowExact.

func WithAsOfCheckSortedness

func WithAsOfCheckSortedness(enabled bool) AsOfJoinOption

WithAsOfCheckSortedness is an alias for WithAsofCheckSortedness.

func WithAsOfStrategy

func WithAsOfStrategy(strategy AsOfStrategy) AsOfJoinOption

WithAsOfStrategy is an alias for WithAsofStrategy.

func WithAsofAllowExact

func WithAsofAllowExact(enabled bool) AsOfJoinOption

WithAsofAllowExact controls whether equal keys may match.

func WithAsofCheckSortedness

func WithAsofCheckSortedness(enabled bool) AsOfJoinOption

WithAsofCheckSortedness asks the native engine to validate key ordering.

func WithAsofStrategy

func WithAsofStrategy(strategy AsofStrategy) AsOfJoinOption

WithAsofStrategy selects an as-of matching direction.

type AsOfStrategy

type AsOfStrategy = core.AsOfStrategy

AsOfStrategy is the conventional initialism spelling of AsofStrategy.

type AsofStrategy

type AsofStrategy = core.AsofStrategy

AsofStrategy selects nearest-key matching direction.

type ColumnNotFoundError

type ColumnNotFoundError = core.ColumnNotFoundError

ColumnNotFoundError reports an unknown column name.

type DataFrame

type DataFrame = core.DataFrame

DataFrame is an eager, immutable table.

func DataFrameFromArrow

func DataFrameFromArrow(table arrow.Table) (*DataFrame, error)

DataFrameFromArrow wraps an Arrow table as a DataFrame.

func DataFrameFromMaps

func DataFrameFromMaps(rows []map[string]any) (*DataFrame, error)

DataFrameFromMaps creates an eager frame from row-oriented maps.

func DataFrameFromRecordBatch

func DataFrameFromRecordBatch(batch arrow.RecordBatch) (*DataFrame, error)

DataFrameFromRecordBatch creates a DataFrame from one record batch.

func DataFrameFromRecordBatches

func DataFrameFromRecordBatches(batches []arrow.RecordBatch) (*DataFrame, error)

DataFrameFromRecordBatches creates a DataFrame from schema-compatible batches.

func DataFrameFromStructs

func DataFrameFromStructs[T any](rows []T) (*DataFrame, error)

DataFrameFromStructs creates an eager frame from exported struct fields.

func NewDataFrame

func NewDataFrame(columns ...*Series) (*DataFrame, error)

NewDataFrame creates an eager frame from columns.

func NewDataFrameFromArrow

func NewDataFrameFromArrow(table arrow.Table) (*DataFrame, error)

NewDataFrameFromArrow creates a DataFrame from an Arrow table.

func NewDataFrameFromMaps

func NewDataFrameFromMaps(rows []map[string]any) (*DataFrame, error)

NewDataFrameFromMaps is an alias for DataFrameFromMaps.

func NewDataFrameFromRecordBatch

func NewDataFrameFromRecordBatch(batch arrow.RecordBatch) (*DataFrame, error)

NewDataFrameFromRecordBatch creates a DataFrame from one record batch.

func NewDataFrameFromRecordBatches

func NewDataFrameFromRecordBatches(batches []arrow.RecordBatch) (*DataFrame, error)

NewDataFrameFromRecordBatches creates a DataFrame from schema-compatible batches.

func NewDataFrameFromStructs

func NewDataFrameFromStructs[T any](rows []T) (*DataFrame, error)

NewDataFrameFromStructs is an alias for DataFrameFromStructs.

func ReadArrow

func ReadArrow(ctx context.Context, path string, options ...ScanOption) (*DataFrame, error)

ReadArrow reads an Arrow IPC file into an eager DataFrame.

func ReadCSV

func ReadCSV(ctx context.Context, path string, options ...ScanOption) (*DataFrame, error)

ReadCSV reads a CSV path into an eager DataFrame.

func ReadCSVReader

func ReadCSVReader(ctx context.Context, reader io.Reader, options ...ScanOption) (*DataFrame, error)

ReadCSVReader reads CSV data from a reader into an eager DataFrame.

func ReadIPCFile

func ReadIPCFile(ctx context.Context, path string, options ...ScanOption) (*DataFrame, error)

ReadIPCFile reads an Arrow IPC file into an eager DataFrame.

func ReadIPCStreamReader

func ReadIPCStreamReader(ctx context.Context, reader io.Reader, options ...ScanOption) (*DataFrame, error)

ReadIPCStreamReader reads an Arrow IPC stream from a reader into a DataFrame.

func ReadJSON

func ReadJSON(ctx context.Context, path string, options ...ScanOption) (*DataFrame, error)

ReadJSON reads a JSON array into an eager DataFrame.

func ReadJSONReader

func ReadJSONReader(ctx context.Context, reader io.Reader, options ...ScanOption) (*DataFrame, error)

ReadJSONReader reads a JSON array from a reader into a DataFrame.

func ReadNDJSON

func ReadNDJSON(ctx context.Context, path string, options ...ScanOption) (*DataFrame, error)

ReadNDJSON reads newline-delimited JSON into an eager DataFrame.

func ReadNDJSONReader

func ReadNDJSONReader(ctx context.Context, reader io.Reader, options ...ScanOption) (*DataFrame, error)

ReadNDJSONReader reads newline-delimited JSON from a reader into a DataFrame.

func ReadParquet

func ReadParquet(ctx context.Context, path string, options ...ScanOption) (*DataFrame, error)

ReadParquet reads a Parquet path into an eager DataFrame.

type DataType

type DataType = core.DataType

DataType describes a column type and can be converted to Arrow.

func DataTypeFromArrow

func DataTypeFromArrow(t arrow.DataType) DataType

DataTypeFromArrow wraps an Arrow data type.

func Datetime

func Datetime(unit arrow.TimeUnit, timezone string) DataType

Datetime creates a timestamp type; it is an alias for Timestamp.

func Decimal32

func Decimal32(precision, scale int32) DataType

Decimal32 creates a 32-bit decimal type.

func Decimal64

func Decimal64(precision, scale int32) DataType

Decimal64 creates a 64-bit decimal type.

func Decimal128

func Decimal128(precision, scale int32) DataType

Decimal128 creates a 128-bit decimal type.

func Decimal256

func Decimal256(precision, scale int32) DataType

Decimal256 creates a 256-bit decimal type.

func DictionaryOf

func DictionaryOf(index, value DataType, ordered bool) DataType

DictionaryOf creates a dictionary type.

func Duration

func Duration(unit arrow.TimeUnit) DataType

Duration creates a duration type with the given unit.

func FixedSizeBinary

func FixedSizeBinary(width int) DataType

FixedSizeBinary creates a fixed-width binary type.

func FixedSizeListOf

func FixedSizeListOf(length int32, elem DataType) DataType

FixedSizeListOf creates a fixed-length list type.

func LargeListOf

func LargeListOf(elem DataType) DataType

LargeListOf creates a 64-bit-offset list type containing elem.

func LargeListViewOf

func LargeListViewOf(elem DataType) DataType

LargeListViewOf creates a 64-bit-offset list-view type containing elem.

func ListOf

func ListOf(elem DataType) DataType

ListOf creates a list type containing elem.

func ListViewOf

func ListViewOf(elem DataType) DataType

ListViewOf creates a list-view type containing elem.

func MapOf

func MapOf(key, item DataType) DataType

MapOf creates a map type with key and item types.

func RunEndEncodedOf

func RunEndEncodedOf(runEnds, values DataType) DataType

RunEndEncodedOf creates a run-end encoded type.

func StructOf

func StructOf(fields ...Field) DataType

StructOf creates a struct type from fields.

func Time

func Time(unit arrow.TimeUnit) DataType

Time creates a time type using the appropriate Arrow width.

func Time32

func Time32(unit arrow.TimeUnit) DataType

Time32 creates a 32-bit time type with the given unit.

func Time64

func Time64(unit arrow.TimeUnit) DataType

Time64 creates a 64-bit time type with the given unit.

func Timestamp

func Timestamp(unit arrow.TimeUnit, timezone string) DataType

Timestamp creates a timestamp type with the given unit and timezone.

type DatasetMode

type DatasetMode = core.DatasetMode

DatasetMode selects dataset creation behavior.

const (
	// DatasetCreate creates a new partitioned dataset and fails if it exists.
	DatasetCreate DatasetMode = core.DatasetCreate
	// DatasetAppend adds files to an existing partitioned dataset.
	DatasetAppend DatasetMode = core.DatasetAppend
)

type DatasetWriteOption

type DatasetWriteOption = core.DatasetWriteOption

DatasetWriteOption configures a dataset sink.

func WithDatasetMode

func WithDatasetMode(mode DatasetMode) DatasetWriteOption

WithDatasetMode sets the dataset creation mode.

func WithPartitionBy

func WithPartitionBy(columns ...string) DatasetWriteOption

WithPartitionBy sets dataset partition columns.

func WithRowsPerFile

func WithRowsPerFile(rows int64) DatasetWriteOption

WithRowsPerFile sets the target rows per dataset file.

type DtExpr

type DtExpr = core.DtExpr

DtExpr provides date and timestamp expressions.

type Engine

type Engine = core.Engine

Engine owns shared execution configuration and object stores.

func NewEngine

func NewEngine(options ...EngineOption) (*Engine, error)

NewEngine creates an execution engine with the supplied options.

type EngineOption

type EngineOption = core.EngineOption

EngineOption configures an Engine.

func WithBatchSize

func WithBatchSize(rows int64) EngineOption

WithBatchSize sets the preferred Arrow batch size.

func WithMemoryLimit

func WithMemoryLimit(bytes int64) EngineOption

WithMemoryLimit sets the engine memory quota in bytes.

func WithObjectStore

func WithObjectStore(scheme string, store ObjectStore) EngineOption

WithObjectStore adds an object store for a URI scheme to an engine.

func WithParallelism

func WithParallelism(n int) EngineOption

WithParallelism sets the engine's parallelism hint.

type Expr

type Expr = core.Expr

Expr is an immutable expression tree.

func All

func All() Expr

All selects all columns in a projection.

func Col

func Col(name string) Expr

Col creates a column expression.

func Count

func Count() Expr

Count creates a row-count aggregation expression.

func DecodeJSON

func DecodeJSON(expr Expr, target any, options ...JSONDecodeOption) Expr

DecodeJSON parses a JSON string expression into a DataType or a Go struct value. Struct targets use exported fields and standard json tags.

func DecodeJSONAs

func DecodeJSONAs[T any](expr Expr, options ...JSONDecodeOption) Expr

DecodeJSONAs parses JSON into the schema derived from T without a zero value.

func Lit

func Lit(value any) Expr

Lit creates a literal expression.

type Field

type Field = core.Field

Field describes one schema field.

type GCSStore

type GCSStore = core.GCSStore

GCSStore is an ObjectStore backed by Google Cloud Storage.

func NewGCSStore

func NewGCSStore(ctx context.Context, options ...option.ClientOption) (*GCSStore, error)

NewGCSStore creates a Google Cloud Storage-backed ObjectStore.

func NewGCSStoreWithClient

func NewGCSStoreWithClient(client *storage.Client) (*GCSStore, error)

NewGCSStoreWithClient wraps an existing Cloud Storage client as an ObjectStore.

type GroupBy

type GroupBy = core.GroupBy

GroupBy builds an eager grouped aggregation.

type JSONDecodeOption

type JSONDecodeOption = core.JSONDecodeOption

JSONDecodeOption configures DecodeJSON.

func WithJSONCoerce

func WithJSONCoerce(enabled bool) JSONDecodeOption

WithJSONCoerce enables or disables compatible JSON-to-type coercions.

func WithJSONErrorMode

func WithJSONErrorMode(mode JSONErrorMode) JSONDecodeOption

WithJSONErrorMode sets the error policy for DecodeJSON.

func WithJSONStrictRequiredFields

func WithJSONStrictRequiredFields(enabled bool) JSONDecodeOption

WithJSONStrictRequiredFields makes non-nullable struct fields required.

type JSONErrorMode

type JSONErrorMode = core.JSONErrorMode

JSONErrorMode controls how invalid JSON rows are handled.

type JoinOption

type JoinOption = core.JoinOption

JoinOption configures a join.

func WithJoinSuffix

func WithJoinSuffix(suffix string) JoinOption

WithJoinSuffix sets the suffix for overlapping right-side columns.

func WithJoinType

func WithJoinType(how JoinType) JoinOption

WithJoinType sets the join type.

type JoinType

type JoinType = core.JoinType

JoinType selects the join operation.

type LazyFrame

type LazyFrame = core.LazyFrame

LazyFrame is a deferred logical plan.

func Scan

func Scan(path string, options ...ScanOption) *LazyFrame

Scan creates a lazy scan whose format is inferred from path.

func ScanArrow

func ScanArrow(path string, options ...ScanOption) *LazyFrame

ScanArrow creates a lazy Arrow IPC file scan.

func ScanCSV

func ScanCSV(path string, options ...ScanOption) *LazyFrame

ScanCSV creates a lazy CSV scan.

func ScanCSVReader

func ScanCSVReader(reader io.Reader, options ...ScanOption) *LazyFrame

ScanCSVReader creates a lazy CSV scan from a reader.

func ScanIPCFile

func ScanIPCFile(path string, options ...ScanOption) *LazyFrame

ScanIPCFile creates a lazy Arrow IPC file scan.

func ScanIPCStream

func ScanIPCStream(path string, options ...ScanOption) *LazyFrame

ScanIPCStream creates a lazy Arrow IPC stream scan.

func ScanIPCStreamReader

func ScanIPCStreamReader(reader io.Reader, options ...ScanOption) *LazyFrame

ScanIPCStreamReader creates a lazy Arrow IPC stream scan from a reader.

func ScanJSON

func ScanJSON(path string, options ...ScanOption) *LazyFrame

ScanJSON creates a lazy JSON array scan.

func ScanJSONReader

func ScanJSONReader(reader io.Reader, options ...ScanOption) *LazyFrame

ScanJSONReader creates a lazy JSON array scan from a reader.

func ScanNDJSON

func ScanNDJSON(path string, options ...ScanOption) *LazyFrame

ScanNDJSON creates a lazy newline-delimited JSON scan.

func ScanNDJSONReader

func ScanNDJSONReader(reader io.Reader, options ...ScanOption) *LazyFrame

ScanNDJSONReader creates a lazy newline-delimited JSON scan from a reader.

func ScanParquet

func ScanParquet(path string, options ...ScanOption) *LazyFrame

ScanParquet creates a lazy Parquet scan.

type LazyGroupBy

type LazyGroupBy = core.LazyGroupBy

LazyGroupBy builds a deferred grouped aggregation.

type ListExpr

type ListExpr = core.ListExpr

ListExpr provides operations on list-valued expressions.

type MemoryLimitError

type MemoryLimitError = core.MemoryLimitError

MemoryLimitError reports an engine memory quota violation.

type ObjectInfo

type ObjectInfo = core.ObjectInfo

ObjectInfo describes an object available from an ObjectStore.

type ObjectStore

type ObjectStore = core.ObjectStore

ObjectStore reads objects addressed by URI.

type RangeObjectStore

type RangeObjectStore = core.RangeObjectStore

RangeObjectStore supports ranged object reads.

type RollingOption

type RollingOption = core.RollingOption

RollingOption configures a fixed-size rolling expression.

func WithRollingCenter

func WithRollingCenter(enabled bool) RollingOption

WithRollingCenter centers a rolling window around each row.

func WithRollingMinPeriods

func WithRollingMinPeriods(periods int64) RollingOption

WithRollingMinPeriods sets the minimum values required by a rolling result.

type Row

type Row = core.Row

Row is a detached row represented by column name and value.

type S3Store

type S3Store = core.S3Store

S3Store is an ObjectStore backed by Amazon S3.

func NewS3Store

func NewS3Store(ctx context.Context, options ...func(*s3.Options)) (*S3Store, error)

NewS3Store creates an S3-backed ObjectStore.

func NewS3StoreWithClient

func NewS3StoreWithClient(client *s3.Client) (*S3Store, error)

NewS3StoreWithClient wraps an existing S3 client as an ObjectStore.

type ScanOption

type ScanOption = core.ScanOption

ScanOption configures a scan.

func WithColumns

func WithColumns(columns ...string) ScanOption

WithColumns limits a scan to the named columns.

func WithComment

func WithComment(comment rune) ScanOption

WithComment ignores CSV records beginning with comment.

func WithDelimiter

func WithDelimiter(delimiter rune) ScanOption

WithDelimiter sets the delimiter for delimited input.

func WithHasHeader

func WithHasHeader(enabled bool) ScanOption

WithHasHeader controls whether delimited input has a header row.

func WithInferSchemaLength

func WithInferSchemaLength(rows int64) ScanOption

WithInferSchemaLength sets the number of CSV rows used for type inference.

func WithNRows

func WithNRows(rows int64) ScanOption

WithNRows limits the number of rows read from a source.

func WithNullValues

func WithNullValues(values ...string) ScanOption

WithNullValues treats supplied CSV values as null.

func WithQuoteChar

func WithQuoteChar(quote rune) ScanOption

WithQuoteChar sets the CSV quote character; zero disables quoting.

func WithScanBatchSize

func WithScanBatchSize(rows int64) ScanOption

WithScanBatchSize sets the preferred scan batch size.

func WithSkipRows

func WithSkipRows(rows int64) ScanOption

WithSkipRows skips rows before a CSV header/data section.

type Schema

type Schema = core.Schema

Schema describes a table's fields and metadata.

func NewSchema

func NewSchema(fields ...Field) Schema

NewSchema creates a schema from fields.

func NewSchemaWithMetadata

func NewSchemaWithMetadata(fields []Field, metadata arrow.Metadata) Schema

NewSchemaWithMetadata creates a schema with fields and metadata.

func SchemaFromArrow

func SchemaFromArrow(schema *arrow.Schema) Schema

SchemaFromArrow wraps an Arrow schema.

type Series

type Series = core.Series

Series is a named, immutable column.

func NewSeries

func NewSeries(name string, values any) (*Series, error)

NewSeries creates a named series from Go or Arrow-compatible values.

func NewSeriesFromArrow

func NewSeriesFromArrow(name string, values arrow.Array) (*Series, error)

NewSeriesFromArrow creates a series from an Arrow array.

func SeriesFromArrow

func SeriesFromArrow(name string, values arrow.Array) *Series

SeriesFromArrow wraps an Arrow array as a series.

func SeriesFromArrowChunked

func SeriesFromArrowChunked(name string, values *arrow.Chunked) *Series

SeriesFromArrowChunked wraps an Arrow chunked array as a series.

type StrExpr

type StrExpr = core.StrExpr

StrExpr provides string expressions.

type StructExpr

type StructExpr = core.StructExpr

StructExpr provides access to fields in struct-valued expressions.

type UnpivotOption

type UnpivotOption = core.UnpivotOption

UnpivotOption configures an unpivot operation.

func WithUnpivotValueName

func WithUnpivotValueName(name string) UnpivotOption

WithUnpivotValueName sets the generated value column name.

func WithUnpivotVariableName

func WithUnpivotVariableName(name string) UnpivotOption

WithUnpivotVariableName sets the generated variable column name.

type WhenThen

type WhenThen = core.WhenThen

WhenThen builds a conditional expression.

func When

func When(predicate Expr) WhenThen

When starts a conditional expression.

type WriteOption

type WriteOption = core.WriteOption

WriteOption configures a file sink.

func WithOverwrite

func WithOverwrite(enabled bool) WriteOption

WithOverwrite controls whether an existing output is replaced.

func WithWriteBatchSize

func WithWriteBatchSize(rows int64) WriteOption

WithWriteBatchSize sets the preferred sink batch size.

func WithWriteDelimiter

func WithWriteDelimiter(delimiter rune) WriteOption

WithWriteDelimiter sets the delimiter for delimited output.

func WithWriteHeader

func WithWriteHeader(enabled bool) WriteOption

WithWriteHeader controls whether delimited output includes a header row.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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