Documentation
¶
Overview ¶
Package data provides JSONL datasets and deterministic stream operations.
Typical use:
@data examples :from="examples.jsonl" @datause examples -> data.split:partition="train" :key="id" :train=80 :validation=10 :test=10 :seed=42 -> data.where:expression="is_positive == true" -> data.select:fields="id,text,label" -> collect
Index ¶
- Constants
- Variables
- func Bundle(_ map[string]string) compiler.Bundle
- func Library() action.Library
- func RowsSource() action.AnyStreamAction
- func Select(cfg selectConfig) action.StreamOp[any, any]
- func SelectOperator() action.NamedOperator
- func Split(cfg splitConfig) action.StreamOp[any, any]
- func SplitOperator() action.NamedOperator
- func Where(cfg whereConfig) action.StreamOp[any, any]
- func WhereOperator() action.NamedOperator
- type Dataset
Constants ¶
const ID = "data"
Variables ¶
var DataDirective = compiler.Directive{
Name: "data",
Example: `@data examples :from="examples.jsonl"`,
Handler: handleData,
}
var DataUseDirective = compiler.Directive{
Name: "datause",
Example: `@datause examples`,
Handler: handleDataUse,
}
Functions ¶
func RowsSource ¶
func RowsSource() action.AnyStreamAction
RowsSource exposes a declared dataset as a fresh, repeatable JSONL stream.
func SelectOperator ¶
func SelectOperator() action.NamedOperator
SelectOperator keeps the requested top-level fields on each row. A requested but absent field is retained with a nil value to keep the output shape stable.
func Split ¶
Split assigns each object to a partition by hashing its stable key and seed. It retains no rows and emits selected values as they arrive, so partition counts are approximate and independent of input order.
func SplitOperator ¶
func SplitOperator() action.NamedOperator
SplitOperator exposes a deterministic, bounded-memory partition selector.
func Where ¶
Where builds a stream operator; expressions see row fields plus `row` and `item`, which both refer to the complete object.
func WhereOperator ¶
func WhereOperator() action.NamedOperator
WhereOperator filters JSON object rows using an expr-lang boolean expression.