Documentation
¶
Index ¶
- func Walk(n ExprNode, fn func(ExprNode) error) error
- type AggNode
- type AggOp
- type AliasNode
- type BinaryNode
- type BinaryOp
- type CastNode
- type ColumnNode
- type Expr
- func Col(name string) Expr
- func Float32(v float32) Expr
- func Float64(v float64) Expr
- func Int8(v int8) Expr
- func Int16(v int16) Expr
- func Int32(v int32) Expr
- func Int64(v int64) Expr
- func Lit(v any) Expr
- func LitTimestamp(t time.Time, tz string) Expr
- func Uint8(v uint8) Expr
- func Uint16(v uint16) Expr
- func Uint32(v uint32) Expr
- func Uint64(v uint64) Expr
- func (e Expr) Add(other Expr) Expr
- func (e Expr) And(other Expr) Expr
- func (e Expr) As(name string) Expr
- func (e Expr) Cast(t arrow.DataType) Expr
- func (e Expr) Count() AggNode
- func (e Expr) Div(other Expr) Expr
- func (e Expr) Eq(other Expr) Expr
- func (e Expr) Gt(other Expr) Expr
- func (e Expr) Gte(other Expr) Expr
- func (e Expr) IsNotNull() Expr
- func (e Expr) IsNull() Expr
- func (e Expr) Lt(other Expr) Expr
- func (e Expr) Lte(other Expr) Expr
- func (e Expr) Max() AggNode
- func (e Expr) Mean() AggNode
- func (e Expr) Min() AggNode
- func (e Expr) Mul(other Expr) Expr
- func (e Expr) Neg() Expr
- func (e Expr) Neq(other Expr) Expr
- func (e Expr) Not() Expr
- func (e Expr) Or(other Expr) Expr
- func (e Expr) String() string
- func (e Expr) Sub(other Expr) Expr
- func (e Expr) Sum() AggNode
- type ExprNode
- type LiteralNode
- type SortKey
- type UnaryNode
- type UnaryOp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AggNode ¶
AggNode is a column-level aggregation used by GroupBy().Agg. It is a concrete public struct rather than an ExprNode: Agg accepts only AggNode values, so passing a non-aggregate expression is a compile-time error. Op is the reduction, Inner is the expression being reduced, and Alias is the output column name (empty means "derive a default").
type AliasNode ¶
AliasNode renames the result of Inner. The output type and value are passed through unchanged; project operators are responsible for using Name when assembling the output schema.
type BinaryNode ¶
BinaryNode is the canonical comparison/logical/arithmetic node. The Op determines result-type rules: comparisons and logical ops produce bool; arithmetic ops use promoteNumeric on the operand types.
func (BinaryNode) Children ¶
func (b BinaryNode) Children() []ExprNode
func (BinaryNode) String ¶
func (b BinaryNode) String() string
type CastNode ¶
CastNode forces the output type of Inner to Type. Bind-time validation only checks that the inner expression resolves; runtime evaluation must verify the cast is supported and report failures.
type ColumnNode ¶
type ColumnNode struct {
Name string
}
ColumnNode references an input column by name. Its output type is resolved against the schema at bind time.
func (ColumnNode) Children ¶
func (c ColumnNode) Children() []ExprNode
func (ColumnNode) String ¶
func (c ColumnNode) String() string
type Expr ¶
type Expr struct {
Node ExprNode
}
Expr is the public, transparent wrapper around an expression tree node. The exported Node field holds the root ExprNode, so the tree is fully inspectable, serializable, and pattern-matchable by external callers. Fluent methods compose new Expr values left-to-right without mutating the receiver.
func Lit ¶
Lit wraps a Go scalar as a literal. The Arrow type is inferred from the value (untyped ints → int64, untyped floats → float64). Use the typed constructors below when you need a specific Arrow width.
func LitTimestamp ¶
LitTimestamp returns an Expr wrapping a LiteralNode of type Timestamp(nanosecond, tz). The instant t is stored as nanoseconds since the Unix epoch (UTC), matching the canonical type inferLiteralType assigns to a bare time.Time literal. tz is the IANA timezone string carried on the Arrow type; pass "" for a timezone-naive timestamp.
type ExprNode ¶
type ExprNode interface {
String() string
Children() []ExprNode
DataType(s *schema.Schema) (arrow.DataType, error)
}
ExprNode is the interface implemented by every node in the public expression tree. Unlike the previous internal design it carries no unexported marker: the node types are a public, inspectable, serializable contract, so external optimizer passes and deserializers may introduce their own implementations.
Children returns this node's direct child nodes in evaluation order and may return nil for leaves. DataType resolves the node's Arrow output type against the input schema without evaluating it.
func Rewrite ¶
Rewrite performs a post-order rewrite of n. Each child is rewritten first, the parent is rebuilt with the new children via withChildren, and finally fn is invoked on the (possibly rebuilt) parent to produce its replacement. Rewrite does not recurse into the replacement, so callers wanting a fixed point should loop until no node changes.
type LiteralNode ¶
LiteralNode is a scalar constant. Type is resolved at construction so that later DataType() calls do not need to re-infer from the Go value.
func (LiteralNode) Children ¶
func (l LiteralNode) Children() []ExprNode
func (LiteralNode) String ¶
func (l LiteralNode) String() string
type SortKey ¶
SortKey describes one column of a multi-column sort: which column, ascending vs descending, and where nulls land. Build one with By and refine it with the fluent Desc / WithNullsFirst methods.
func (SortKey) WithNullsFirst ¶
WithNullsFirst orders nulls before non-null values for this key.