Documentation
¶
Overview ¶
Package expr provides expression evaluation for DataFrame operations
Index ¶
- Constants
- func ExpressionToColumnName(expr Expr) string
- func ValidateExpressionContext(expr Expr, ctx EvaluationContext) error
- type AggregationContext
- func (ac *AggregationContext) AddMapping(exprStr, columnName string)
- func (ac *AggregationContext) AllMappings() map[string]string
- func (ac *AggregationContext) Clear()
- func (ac *AggregationContext) GetColumnName(exprStr string) (string, bool)
- func (ac *AggregationContext) GetExpression(columnName string) (string, bool)
- func (ac *AggregationContext) HasMapping(exprStr string) bool
- func (ac *AggregationContext) String() string
- type AggregationExpr
- func (a *AggregationExpr) Abs() *FunctionExpr
- func (a *AggregationExpr) Add(other Expr) *BinaryExpr
- func (a *AggregationExpr) AggType() AggregationType
- func (a *AggregationExpr) Alias() string
- func (a *AggregationExpr) And(other Expr) *BinaryExpr
- func (a *AggregationExpr) As(alias string) *AggregationExpr
- func (a *AggregationExpr) Ceil() *FunctionExpr
- func (a *AggregationExpr) Column() Expr
- func (a *AggregationExpr) Div(other Expr) *BinaryExpr
- func (a *AggregationExpr) Eq(other Expr) *BinaryExpr
- func (a *AggregationExpr) Floor() *FunctionExpr
- func (a *AggregationExpr) Ge(other Expr) *BinaryExpr
- func (a *AggregationExpr) Gt(other Expr) *BinaryExpr
- func (a *AggregationExpr) Le(other Expr) *BinaryExpr
- func (a *AggregationExpr) Log() *FunctionExpr
- func (a *AggregationExpr) Lt(other Expr) *BinaryExpr
- func (a *AggregationExpr) Mul(other Expr) *BinaryExpr
- func (a *AggregationExpr) Ne(other Expr) *BinaryExpr
- func (a *AggregationExpr) Neg() *UnaryExpr
- func (a *AggregationExpr) Not() *UnaryExpr
- func (a *AggregationExpr) Or(other Expr) *BinaryExpr
- func (a *AggregationExpr) Over(window *WindowSpec) *WindowExpr
- func (a *AggregationExpr) Round() *FunctionExpr
- func (a *AggregationExpr) RoundTo(precision Expr) *FunctionExpr
- func (a *AggregationExpr) Sqrt() *FunctionExpr
- func (a *AggregationExpr) String() string
- func (a *AggregationExpr) Sub(other Expr) *BinaryExpr
- func (a *AggregationExpr) SupportsContext(ctx EvaluationContext) bool
- func (a *AggregationExpr) Type() ExprType
- type AggregationType
- type AliasResolver
- func (ar *AliasResolver) AddAggregation(aggExpr *AggregationExpr) error
- func (ar *AliasResolver) AddGroupByColumn(columnName string)
- func (ar *AliasResolver) GenerateDefaultName(aggExpr *AggregationExpr) string
- func (ar *AliasResolver) GetAllAvailableAliases() []string
- func (ar *AliasResolver) GetAvailableAliases(columnName string) []string
- func (ar *AliasResolver) GetColumnNameFromExpression(exprStr string) (string, bool)
- func (ar *AliasResolver) ResolveAlias(alias string) (string, bool)
- func (ar *AliasResolver) ValidateAlias(alias string) error
- type BinaryExpr
- func (b *BinaryExpr) Abs() *FunctionExpr
- func (b *BinaryExpr) Add(other Expr) *BinaryExpr
- func (b *BinaryExpr) And(other Expr) *BinaryExpr
- func (b *BinaryExpr) Ceil() *FunctionExpr
- func (b *BinaryExpr) Cos() *FunctionExpr
- func (b *BinaryExpr) Div(other Expr) *BinaryExpr
- func (b *BinaryExpr) Eq(other Expr) *BinaryExpr
- func (b *BinaryExpr) Floor() *FunctionExpr
- func (b *BinaryExpr) Ge(other Expr) *BinaryExpr
- func (b *BinaryExpr) Gt(other Expr) *BinaryExpr
- func (b *BinaryExpr) Le(other Expr) *BinaryExpr
- func (b *BinaryExpr) Left() Expr
- func (b *BinaryExpr) Log() *FunctionExpr
- func (b *BinaryExpr) Lt(other Expr) *BinaryExpr
- func (b *BinaryExpr) Mul(other Expr) *BinaryExpr
- func (b *BinaryExpr) Ne(other Expr) *BinaryExpr
- func (b *BinaryExpr) Op() BinaryOp
- func (b *BinaryExpr) Or(other Expr) *BinaryExpr
- func (b *BinaryExpr) Right() Expr
- func (b *BinaryExpr) Round() *FunctionExpr
- func (b *BinaryExpr) RoundTo(precision Expr) *FunctionExpr
- func (b *BinaryExpr) Sin() *FunctionExpr
- func (b *BinaryExpr) Sqrt() *FunctionExpr
- func (b *BinaryExpr) String() string
- func (b *BinaryExpr) Sub(other Expr) *BinaryExpr
- func (b *BinaryExpr) SupportsContext(ctx EvaluationContext) bool
- func (b *BinaryExpr) Type() ExprType
- type BinaryOp
- type BoundaryType
- type CaseExpr
- func (c *CaseExpr) Else(value Expr) *CaseExpr
- func (c *CaseExpr) ElseValue() Expr
- func (c *CaseExpr) String() string
- func (c *CaseExpr) SupportsContext(ctx EvaluationContext) bool
- func (c *CaseExpr) Type() ExprType
- func (c *CaseExpr) When(condition, value Expr) *CaseExpr
- func (c *CaseExpr) Whens() []CaseWhen
- type CaseWhen
- type ColumnExpr
- func (c *ColumnExpr) Abs() *FunctionExpr
- func (c *ColumnExpr) Add(other Expr) *BinaryExpr
- func (c *ColumnExpr) CastToBool() *FunctionExpr
- func (c *ColumnExpr) CastToFloat64() *FunctionExpr
- func (c *ColumnExpr) CastToInt64() *FunctionExpr
- func (c *ColumnExpr) CastToString() *FunctionExpr
- func (c *ColumnExpr) Ceil() *FunctionExpr
- func (c *ColumnExpr) Cos() *FunctionExpr
- func (c *ColumnExpr) Count() *AggregationExpr
- func (c *ColumnExpr) DateAdd(intervalExpr *IntervalExpr) *FunctionExpr
- func (c *ColumnExpr) DateSub(intervalExpr *IntervalExpr) *FunctionExpr
- func (c *ColumnExpr) Day() *FunctionExpr
- func (c *ColumnExpr) Div(other Expr) *BinaryExpr
- func (c *ColumnExpr) Eq(other Expr) *BinaryExpr
- func (c *ColumnExpr) Floor() *FunctionExpr
- func (c *ColumnExpr) Ge(other Expr) *BinaryExpr
- func (c *ColumnExpr) Gt(other Expr) *BinaryExpr
- func (c *ColumnExpr) Hour() *FunctionExpr
- func (c *ColumnExpr) Le(other Expr) *BinaryExpr
- func (c *ColumnExpr) Length() *FunctionExpr
- func (c *ColumnExpr) Log() *FunctionExpr
- func (c *ColumnExpr) Lower() *FunctionExpr
- func (c *ColumnExpr) Lt(other Expr) *BinaryExpr
- func (c *ColumnExpr) Max() *AggregationExpr
- func (c *ColumnExpr) Mean() *AggregationExpr
- func (c *ColumnExpr) Min() *AggregationExpr
- func (c *ColumnExpr) Minute() *FunctionExpr
- func (c *ColumnExpr) Month() *FunctionExpr
- func (c *ColumnExpr) Mul(other Expr) *BinaryExpr
- func (c *ColumnExpr) Name() string
- func (c *ColumnExpr) Ne(other Expr) *BinaryExpr
- func (c *ColumnExpr) Neg() *UnaryExpr
- func (c *ColumnExpr) Not() *UnaryExpr
- func (c *ColumnExpr) Round() *FunctionExpr
- func (c *ColumnExpr) RoundTo(precision Expr) *FunctionExpr
- func (c *ColumnExpr) Second() *FunctionExpr
- func (c *ColumnExpr) Sin() *FunctionExpr
- func (c *ColumnExpr) Sqrt() *FunctionExpr
- func (c *ColumnExpr) String() string
- func (c *ColumnExpr) Sub(other Expr) *BinaryExpr
- func (c *ColumnExpr) Substring(start, length Expr) *FunctionExpr
- func (c *ColumnExpr) Sum() *AggregationExpr
- func (c *ColumnExpr) SupportsContext(ctx EvaluationContext) bool
- func (c *ColumnExpr) Trim() *FunctionExpr
- func (c *ColumnExpr) Type() ExprType
- func (c *ColumnExpr) Upper() *FunctionExpr
- func (c *ColumnExpr) Year() *FunctionExpr
- type ContextualExpr
- type EvaluationContext
- type Evaluator
- func (e *Evaluator) Evaluate(expr Expr, columns map[string]arrow.Array) (arrow.Array, error)
- func (e *Evaluator) EvaluateBoolean(expr Expr, columns map[string]arrow.Array) (arrow.Array, error)
- func (e *Evaluator) EvaluateBooleanWithContext(expr Expr, columns map[string]arrow.Array, ctx EvaluationContext) (arrow.Array, error)
- func (e *Evaluator) EvaluateWindow(expr *WindowExpr, columns map[string]arrow.Array) (arrow.Array, error)
- func (e *Evaluator) EvaluateWithContext(expr Expr, columns map[string]arrow.Array, ctx EvaluationContext) (arrow.Array, error)
- type Expr
- type ExprType
- type FrameBoundary
- type FrameType
- type FunctionExpr
- func Coalesce(exprs ...Expr) *FunctionExpr
- func Concat(exprs ...Expr) *FunctionExpr
- func DateAdd(dateExpr Expr, intervalExpr *IntervalExpr) *FunctionExpr
- func DateDiff(startDate, endDate Expr, unit string) *FunctionExpr
- func DateSub(dateExpr Expr, intervalExpr *IntervalExpr) *FunctionExpr
- func Day(expr Expr) *FunctionExpr
- func Hour(expr Expr) *FunctionExpr
- func If(condition, thenValue, elseValue Expr) *FunctionExpr
- func Minute(expr Expr) *FunctionExpr
- func Month(expr Expr) *FunctionExpr
- func NewFunction(name string, args ...Expr) *FunctionExpr
- func Second(expr Expr) *FunctionExpr
- func Year(expr Expr) *FunctionExpr
- func (f *FunctionExpr) Abs() *FunctionExpr
- func (f *FunctionExpr) Add(other Expr) *BinaryExpr
- func (f *FunctionExpr) And(other Expr) *BinaryExpr
- func (f *FunctionExpr) Args() []Expr
- func (f *FunctionExpr) CastToBool() *FunctionExpr
- func (f *FunctionExpr) CastToFloat64() *FunctionExpr
- func (f *FunctionExpr) CastToInt64() *FunctionExpr
- func (f *FunctionExpr) CastToString() *FunctionExpr
- func (f *FunctionExpr) Ceil() *FunctionExpr
- func (f *FunctionExpr) Cos() *FunctionExpr
- func (f *FunctionExpr) DateAdd(intervalExpr *IntervalExpr) *FunctionExpr
- func (f *FunctionExpr) DateSub(intervalExpr *IntervalExpr) *FunctionExpr
- func (f *FunctionExpr) Day() *FunctionExpr
- func (f *FunctionExpr) Div(other Expr) *BinaryExpr
- func (f *FunctionExpr) Eq(other Expr) *BinaryExpr
- func (f *FunctionExpr) Floor() *FunctionExpr
- func (f *FunctionExpr) Ge(other Expr) *BinaryExpr
- func (f *FunctionExpr) Gt(other Expr) *BinaryExpr
- func (f *FunctionExpr) Hour() *FunctionExpr
- func (f *FunctionExpr) Le(other Expr) *BinaryExpr
- func (f *FunctionExpr) Length() *FunctionExpr
- func (f *FunctionExpr) Log() *FunctionExpr
- func (f *FunctionExpr) Lower() *FunctionExpr
- func (f *FunctionExpr) Lt(other Expr) *BinaryExpr
- func (f *FunctionExpr) Minute() *FunctionExpr
- func (f *FunctionExpr) Month() *FunctionExpr
- func (f *FunctionExpr) Mul(other Expr) *BinaryExpr
- func (f *FunctionExpr) Name() string
- func (f *FunctionExpr) Ne(other Expr) *BinaryExpr
- func (f *FunctionExpr) Neg() *UnaryExpr
- func (f *FunctionExpr) Not() *UnaryExpr
- func (f *FunctionExpr) Or(other Expr) *BinaryExpr
- func (f *FunctionExpr) Round() *FunctionExpr
- func (f *FunctionExpr) RoundTo(precision Expr) *FunctionExpr
- func (f *FunctionExpr) Second() *FunctionExpr
- func (f *FunctionExpr) Sin() *FunctionExpr
- func (f *FunctionExpr) Sqrt() *FunctionExpr
- func (f *FunctionExpr) String() string
- func (f *FunctionExpr) Sub(other Expr) *BinaryExpr
- func (f *FunctionExpr) Substring(start, length Expr) *FunctionExpr
- func (f *FunctionExpr) SupportsContext(ctx EvaluationContext) bool
- func (f *FunctionExpr) Trim() *FunctionExpr
- func (f *FunctionExpr) Type() ExprType
- func (f *FunctionExpr) Upper() *FunctionExpr
- func (f *FunctionExpr) Year() *FunctionExpr
- type HavingValidator
- func BuildHavingValidatorWithAlias(groupByColumns []string, aggregations []*AggregationExpr, caseInsensitive bool) (*HavingValidator, error)
- func NewHavingValidator(aggregationContext *AggregationContext, groupByColumns []string) *HavingValidator
- func NewHavingValidatorWithAlias(aggregationContext *AggregationContext, groupByColumns []string, ...) *HavingValidator
- type IntervalExpr
- type IntervalType
- type InvalidExpr
- type LiteralExpr
- type OrderByExpr
- type UnaryExpr
- type UnaryOp
- type WindowExpr
- type WindowFrame
- type WindowFunctionExpr
- func DenseRank() *WindowFunctionExpr
- func FirstValue(expr Expr) *WindowFunctionExpr
- func Lag(expr Expr, offset int) *WindowFunctionExpr
- func LastValue(expr Expr) *WindowFunctionExpr
- func Lead(expr Expr, offset int) *WindowFunctionExpr
- func Rank() *WindowFunctionExpr
- func RowNumber() *WindowFunctionExpr
- type WindowParallelConfig
- type WindowSpec
Constants ¶
const ( AggNameSum = "sum" AggNameCount = "count" AggNameMean = "mean" AggNameMin = "min" AggNameMax = "max" )
Aggregation function name constants
Variables ¶
This section is empty.
Functions ¶
func ExpressionToColumnName ¶ added in v0.3.0
ExpressionToColumnName converts an aggregation expression to its standardized column name This is used to generate consistent column names for aggregated results
func ValidateExpressionContext ¶ added in v0.3.0
func ValidateExpressionContext(expr Expr, ctx EvaluationContext) error
ValidateExpressionContext validates that an expression can be used in the given context
Types ¶
type AggregationContext ¶ added in v0.3.0
type AggregationContext struct {
// contains filtered or unexported fields
}
AggregationContext manages mapping between aggregated column references and their actual column names in GROUP BY results.
When HAVING expressions reference aggregation results like SUM(sales), the context maps these to the actual column names in the aggregated DataFrame (e.g., "sum_sales").
func BuildContextFromAggregations ¶ added in v0.3.0
func BuildContextFromAggregations(aggregations []*AggregationExpr) *AggregationContext
BuildContextFromAggregations creates an AggregationContext from a list of aggregation expressions
func NewAggregationContext ¶ added in v0.3.0
func NewAggregationContext() *AggregationContext
NewAggregationContext creates a new AggregationContext
func (*AggregationContext) AddMapping ¶ added in v0.3.0
func (ac *AggregationContext) AddMapping(exprStr, columnName string)
AddMapping adds a mapping between an aggregation expression and its column name
func (*AggregationContext) AllMappings ¶ added in v0.3.0
func (ac *AggregationContext) AllMappings() map[string]string
AllMappings returns all column mappings
func (*AggregationContext) Clear ¶ added in v0.3.0
func (ac *AggregationContext) Clear()
Clear removes all mappings
func (*AggregationContext) GetColumnName ¶ added in v0.3.0
func (ac *AggregationContext) GetColumnName(exprStr string) (string, bool)
GetColumnName returns the column name for the given expression string
func (*AggregationContext) GetExpression ¶ added in v0.3.0
func (ac *AggregationContext) GetExpression(columnName string) (string, bool)
GetExpression returns the expression string for the given column name
func (*AggregationContext) HasMapping ¶ added in v0.3.0
func (ac *AggregationContext) HasMapping(exprStr string) bool
HasMapping checks if a mapping exists for the given expression string
func (*AggregationContext) String ¶ added in v0.3.0
func (ac *AggregationContext) String() string
String returns a string representation of the context
type AggregationExpr ¶
type AggregationExpr struct {
// contains filtered or unexported fields
}
AggregationExpr represents an aggregation function over a column
func (*AggregationExpr) Abs ¶ added in v0.3.0
func (a *AggregationExpr) Abs() *FunctionExpr
Abs creates an absolute value function expression
func (*AggregationExpr) Add ¶ added in v0.3.0
func (a *AggregationExpr) Add(other Expr) *BinaryExpr
Add creates an addition expression
func (*AggregationExpr) AggType ¶
func (a *AggregationExpr) AggType() AggregationType
func (*AggregationExpr) Alias ¶
func (a *AggregationExpr) Alias() string
func (*AggregationExpr) And ¶ added in v0.3.0
func (a *AggregationExpr) And(other Expr) *BinaryExpr
And creates a logical AND expression
func (*AggregationExpr) As ¶
func (a *AggregationExpr) As(alias string) *AggregationExpr
As sets an alias for the aggregation expression
func (*AggregationExpr) Ceil ¶ added in v0.3.0
func (a *AggregationExpr) Ceil() *FunctionExpr
Ceil creates a ceil function expression
func (*AggregationExpr) Column ¶
func (a *AggregationExpr) Column() Expr
func (*AggregationExpr) Div ¶ added in v0.3.0
func (a *AggregationExpr) Div(other Expr) *BinaryExpr
Div creates a division expression
func (*AggregationExpr) Eq ¶ added in v0.3.0
func (a *AggregationExpr) Eq(other Expr) *BinaryExpr
Eq creates an equality expression
func (*AggregationExpr) Floor ¶ added in v0.3.0
func (a *AggregationExpr) Floor() *FunctionExpr
Floor creates a floor function expression
func (*AggregationExpr) Ge ¶ added in v0.3.0
func (a *AggregationExpr) Ge(other Expr) *BinaryExpr
Ge creates a greater-than-or-equal expression
func (*AggregationExpr) Gt ¶ added in v0.3.0
func (a *AggregationExpr) Gt(other Expr) *BinaryExpr
Gt creates a greater-than expression
func (*AggregationExpr) Le ¶ added in v0.3.0
func (a *AggregationExpr) Le(other Expr) *BinaryExpr
Le creates a less-than-or-equal expression
func (*AggregationExpr) Log ¶ added in v0.3.0
func (a *AggregationExpr) Log() *FunctionExpr
Log creates a natural logarithm function expression
func (*AggregationExpr) Lt ¶ added in v0.3.0
func (a *AggregationExpr) Lt(other Expr) *BinaryExpr
Lt creates a less-than expression
func (*AggregationExpr) Mul ¶ added in v0.3.0
func (a *AggregationExpr) Mul(other Expr) *BinaryExpr
Mul creates a multiplication expression
func (*AggregationExpr) Ne ¶ added in v0.3.0
func (a *AggregationExpr) Ne(other Expr) *BinaryExpr
Ne creates a not-equal expression
func (*AggregationExpr) Neg ¶ added in v0.3.0
func (a *AggregationExpr) Neg() *UnaryExpr
Neg creates a negation (unary minus) expression
func (*AggregationExpr) Not ¶ added in v0.3.0
func (a *AggregationExpr) Not() *UnaryExpr
Not creates a logical NOT expression
func (*AggregationExpr) Or ¶ added in v0.3.0
func (a *AggregationExpr) Or(other Expr) *BinaryExpr
Or creates a logical OR expression
func (*AggregationExpr) Over ¶ added in v0.2.0
func (a *AggregationExpr) Over(window *WindowSpec) *WindowExpr
Over creates a window expression with the specified window for aggregation functions
func (*AggregationExpr) Round ¶ added in v0.3.0
func (a *AggregationExpr) Round() *FunctionExpr
Round creates a round function expression
func (*AggregationExpr) RoundTo ¶ added in v0.3.0
func (a *AggregationExpr) RoundTo(precision Expr) *FunctionExpr
RoundTo creates a round function expression with precision
func (*AggregationExpr) Sqrt ¶ added in v0.3.0
func (a *AggregationExpr) Sqrt() *FunctionExpr
Sqrt creates a square root function expression
func (*AggregationExpr) String ¶
func (a *AggregationExpr) String() string
func (*AggregationExpr) Sub ¶ added in v0.3.0
func (a *AggregationExpr) Sub(other Expr) *BinaryExpr
Sub creates a subtraction expression
func (*AggregationExpr) SupportsContext ¶ added in v0.3.0
func (a *AggregationExpr) SupportsContext(ctx EvaluationContext) bool
SupportsContext returns whether this expression can be evaluated in the given context AggregationExpr can only be evaluated in GroupContext
func (*AggregationExpr) Type ¶
func (a *AggregationExpr) Type() ExprType
type AggregationType ¶
type AggregationType int
AggregationType represents the type of aggregation function
const ( AggSum AggregationType = iota AggCount AggMean AggMin AggMax )
type AliasResolver ¶ added in v0.3.0
type AliasResolver struct {
// contains filtered or unexported fields
}
AliasResolver handles comprehensive alias resolution for HAVING clauses. It supports user-defined aliases, default aggregation names, and GROUP BY columns, providing a unified interface for column name resolution.
func BuildAliasResolver ¶ added in v0.3.0
func BuildAliasResolver( groupByColumns []string, aggregations []*AggregationExpr, caseInsensitive bool, ) (*AliasResolver, error)
BuildAliasResolver creates an AliasResolver from GROUP BY columns and aggregation expressions. This is a convenience function for common setup scenarios.
func NewAliasResolver ¶ added in v0.3.0
func NewAliasResolver(caseInsensitive bool) *AliasResolver
NewAliasResolver creates a new AliasResolver with the specified configuration.
func (*AliasResolver) AddAggregation ¶ added in v0.3.0
func (ar *AliasResolver) AddAggregation(aggExpr *AggregationExpr) error
AddAggregation adds an aggregation expression with its optional user-defined alias. This handles both user aliases and default names for aggregation expressions.
func (*AliasResolver) AddGroupByColumn ¶ added in v0.3.0
func (ar *AliasResolver) AddGroupByColumn(columnName string)
AddGroupByColumn adds a GROUP BY column to the resolver. GROUP BY columns can be referenced by their original names in HAVING.
func (*AliasResolver) GenerateDefaultName ¶ added in v0.3.0
func (ar *AliasResolver) GenerateDefaultName(aggExpr *AggregationExpr) string
GenerateDefaultName creates a default column name for an aggregation expression.
func (*AliasResolver) GetAllAvailableAliases ¶ added in v0.3.0
func (ar *AliasResolver) GetAllAvailableAliases() []string
GetAllAvailableAliases returns all aliases that can be used in HAVING clauses. This includes GROUP BY columns, user-defined aliases, and default aggregation names.
func (*AliasResolver) GetAvailableAliases ¶ added in v0.3.0
func (ar *AliasResolver) GetAvailableAliases(columnName string) []string
GetAvailableAliases returns all valid aliases for a given column name. This is useful for error messages and user assistance.
func (*AliasResolver) GetColumnNameFromExpression ¶ added in v0.3.0
func (ar *AliasResolver) GetColumnNameFromExpression(exprStr string) (string, bool)
GetColumnNameFromExpression resolves a column name from an aggregation expression string. This is used when validating direct aggregation references in HAVING.
func (*AliasResolver) ResolveAlias ¶ added in v0.3.0
func (ar *AliasResolver) ResolveAlias(alias string) (string, bool)
ResolveAlias attempts to resolve an alias to its actual column name. It checks user aliases, default names, and GROUP BY columns in that order.
func (*AliasResolver) ValidateAlias ¶ added in v0.3.0
func (ar *AliasResolver) ValidateAlias(alias string) error
ValidateAlias checks if the given alias is valid and unambiguous.
type BinaryExpr ¶
type BinaryExpr struct {
// contains filtered or unexported fields
}
BinaryExpr represents a binary operation
func NewBinaryExpr ¶ added in v0.3.0
func NewBinaryExpr(left Expr, op BinaryOp, right Expr) *BinaryExpr
NewBinaryExpr creates a new binary expression
func (*BinaryExpr) Abs ¶
func (b *BinaryExpr) Abs() *FunctionExpr
Abs creates an absolute value function expression
func (*BinaryExpr) Add ¶
func (b *BinaryExpr) Add(other Expr) *BinaryExpr
Add creates an addition expression
func (*BinaryExpr) And ¶
func (b *BinaryExpr) And(other Expr) *BinaryExpr
And creates a logical AND expression
func (*BinaryExpr) Ceil ¶
func (b *BinaryExpr) Ceil() *FunctionExpr
Ceil creates a ceil function expression
func (*BinaryExpr) Cos ¶
func (b *BinaryExpr) Cos() *FunctionExpr
Cos creates a cosine function expression
func (*BinaryExpr) Div ¶
func (b *BinaryExpr) Div(other Expr) *BinaryExpr
Div creates a division expression
func (*BinaryExpr) Eq ¶ added in v0.3.0
func (b *BinaryExpr) Eq(other Expr) *BinaryExpr
Eq creates an equality expression
func (*BinaryExpr) Floor ¶
func (b *BinaryExpr) Floor() *FunctionExpr
Floor creates a floor function expression
func (*BinaryExpr) Ge ¶ added in v0.3.0
func (b *BinaryExpr) Ge(other Expr) *BinaryExpr
Ge creates a greater-than-or-equal expression
func (*BinaryExpr) Gt ¶ added in v0.3.0
func (b *BinaryExpr) Gt(other Expr) *BinaryExpr
Gt creates a greater-than expression
func (*BinaryExpr) Le ¶ added in v0.3.0
func (b *BinaryExpr) Le(other Expr) *BinaryExpr
Le creates a less-than-or-equal expression
func (*BinaryExpr) Left ¶
func (b *BinaryExpr) Left() Expr
func (*BinaryExpr) Log ¶
func (b *BinaryExpr) Log() *FunctionExpr
Log creates a natural logarithm function expression
func (*BinaryExpr) Lt ¶ added in v0.3.0
func (b *BinaryExpr) Lt(other Expr) *BinaryExpr
Lt creates a less-than expression
func (*BinaryExpr) Mul ¶
func (b *BinaryExpr) Mul(other Expr) *BinaryExpr
Mul creates a multiplication expression
func (*BinaryExpr) Ne ¶ added in v0.3.0
func (b *BinaryExpr) Ne(other Expr) *BinaryExpr
Ne creates a not-equal expression
func (*BinaryExpr) Op ¶
func (b *BinaryExpr) Op() BinaryOp
func (*BinaryExpr) Or ¶
func (b *BinaryExpr) Or(other Expr) *BinaryExpr
Or creates a logical OR expression
func (*BinaryExpr) Right ¶
func (b *BinaryExpr) Right() Expr
func (*BinaryExpr) Round ¶
func (b *BinaryExpr) Round() *FunctionExpr
Round creates a round function expression
func (*BinaryExpr) RoundTo ¶
func (b *BinaryExpr) RoundTo(precision Expr) *FunctionExpr
RoundTo creates a round function expression with precision
func (*BinaryExpr) Sin ¶
func (b *BinaryExpr) Sin() *FunctionExpr
Sin creates a sine function expression
func (*BinaryExpr) Sqrt ¶
func (b *BinaryExpr) Sqrt() *FunctionExpr
Sqrt creates a square root function expression
func (*BinaryExpr) String ¶
func (b *BinaryExpr) String() string
func (*BinaryExpr) Sub ¶
func (b *BinaryExpr) Sub(other Expr) *BinaryExpr
Sub creates a subtraction expression
func (*BinaryExpr) SupportsContext ¶ added in v0.3.0
func (b *BinaryExpr) SupportsContext(ctx EvaluationContext) bool
SupportsContext returns whether this expression can be evaluated in the given context BinaryExpr context support depends on operands
func (*BinaryExpr) Type ¶
func (b *BinaryExpr) Type() ExprType
type BoundaryType ¶ added in v0.2.0
type BoundaryType int
BoundaryType represents the type of frame boundary
const ( BoundaryUnboundedPreceding BoundaryType = iota BoundaryPreceding BoundaryCurrentRow BoundaryFollowing BoundaryUnboundedFollowing )
type CaseExpr ¶
type CaseExpr struct {
// contains filtered or unexported fields
}
CaseExpr represents a CASE expression with multiple WHEN clauses
func (*CaseExpr) SupportsContext ¶ added in v0.3.0
func (c *CaseExpr) SupportsContext(ctx EvaluationContext) bool
SupportsContext returns whether this expression can be evaluated in the given context CaseExpr context support depends on all its conditions and values
type CaseWhen ¶
type CaseWhen struct {
// contains filtered or unexported fields
}
CaseWhen represents a condition and value pair in CASE expression
type ColumnExpr ¶
type ColumnExpr struct {
// contains filtered or unexported fields
}
ColumnExpr represents a column reference
func (*ColumnExpr) Abs ¶
func (c *ColumnExpr) Abs() *FunctionExpr
Abs creates an absolute value function expression
func (*ColumnExpr) Add ¶
func (c *ColumnExpr) Add(other Expr) *BinaryExpr
Add creates an addition expression
func (*ColumnExpr) CastToBool ¶
func (c *ColumnExpr) CastToBool() *FunctionExpr
CastToBool creates a cast to bool function expression
func (*ColumnExpr) CastToFloat64 ¶
func (c *ColumnExpr) CastToFloat64() *FunctionExpr
CastToFloat64 creates a cast to float64 function expression
func (*ColumnExpr) CastToInt64 ¶
func (c *ColumnExpr) CastToInt64() *FunctionExpr
CastToInt64 creates a cast to int64 function expression
func (*ColumnExpr) CastToString ¶
func (c *ColumnExpr) CastToString() *FunctionExpr
CastToString creates a cast to string function expression
func (*ColumnExpr) Ceil ¶
func (c *ColumnExpr) Ceil() *FunctionExpr
Ceil creates a ceil function expression
func (*ColumnExpr) Cos ¶
func (c *ColumnExpr) Cos() *FunctionExpr
Cos creates a cosine function expression
func (*ColumnExpr) Count ¶
func (c *ColumnExpr) Count() *AggregationExpr
Count creates a count aggregation of this column
func (*ColumnExpr) DateAdd ¶ added in v0.3.0
func (c *ColumnExpr) DateAdd(intervalExpr *IntervalExpr) *FunctionExpr
DateAdd adds an interval to a date/time column
func (*ColumnExpr) DateSub ¶ added in v0.3.0
func (c *ColumnExpr) DateSub(intervalExpr *IntervalExpr) *FunctionExpr
DateSub subtracts an interval from a date/time column
func (*ColumnExpr) Day ¶ added in v0.2.0
func (c *ColumnExpr) Day() *FunctionExpr
Day creates a DAY function expression to extract day from date/time
func (*ColumnExpr) Div ¶
func (c *ColumnExpr) Div(other Expr) *BinaryExpr
Div creates a division expression
func (*ColumnExpr) Eq ¶
func (c *ColumnExpr) Eq(other Expr) *BinaryExpr
Eq creates an equality expression
func (*ColumnExpr) Floor ¶
func (c *ColumnExpr) Floor() *FunctionExpr
Floor creates a floor function expression
func (*ColumnExpr) Ge ¶
func (c *ColumnExpr) Ge(other Expr) *BinaryExpr
Ge creates a greater-than-or-equal expression
func (*ColumnExpr) Gt ¶
func (c *ColumnExpr) Gt(other Expr) *BinaryExpr
Gt creates a greater-than expression
func (*ColumnExpr) Hour ¶ added in v0.2.0
func (c *ColumnExpr) Hour() *FunctionExpr
Hour creates an HOUR function expression to extract hour from timestamp
func (*ColumnExpr) Le ¶
func (c *ColumnExpr) Le(other Expr) *BinaryExpr
Le creates a less-than-or-equal expression
func (*ColumnExpr) Length ¶
func (c *ColumnExpr) Length() *FunctionExpr
Length creates a LENGTH function expression
func (*ColumnExpr) Log ¶
func (c *ColumnExpr) Log() *FunctionExpr
Log creates a natural logarithm function expression
func (*ColumnExpr) Lower ¶
func (c *ColumnExpr) Lower() *FunctionExpr
Lower creates a LOWER function expression
func (*ColumnExpr) Lt ¶
func (c *ColumnExpr) Lt(other Expr) *BinaryExpr
Lt creates a less-than expression
func (*ColumnExpr) Max ¶
func (c *ColumnExpr) Max() *AggregationExpr
Max creates a max aggregation of this column
func (*ColumnExpr) Mean ¶
func (c *ColumnExpr) Mean() *AggregationExpr
Mean creates a mean aggregation of this column
func (*ColumnExpr) Min ¶
func (c *ColumnExpr) Min() *AggregationExpr
Min creates a min aggregation of this column
func (*ColumnExpr) Minute ¶ added in v0.2.0
func (c *ColumnExpr) Minute() *FunctionExpr
Minute creates a MINUTE function expression to extract minute from timestamp
func (*ColumnExpr) Month ¶ added in v0.2.0
func (c *ColumnExpr) Month() *FunctionExpr
Month creates a MONTH function expression to extract month from date/time
func (*ColumnExpr) Mul ¶
func (c *ColumnExpr) Mul(other Expr) *BinaryExpr
Mul creates a multiplication expression
func (*ColumnExpr) Name ¶
func (c *ColumnExpr) Name() string
func (*ColumnExpr) Ne ¶
func (c *ColumnExpr) Ne(other Expr) *BinaryExpr
Ne creates a not-equal expression
func (*ColumnExpr) Neg ¶
func (c *ColumnExpr) Neg() *UnaryExpr
Neg creates a negation (unary minus) expression
func (*ColumnExpr) Round ¶
func (c *ColumnExpr) Round() *FunctionExpr
Round creates a round function expression
func (*ColumnExpr) RoundTo ¶
func (c *ColumnExpr) RoundTo(precision Expr) *FunctionExpr
RoundTo creates a round function expression with precision
func (*ColumnExpr) Second ¶ added in v0.2.0
func (c *ColumnExpr) Second() *FunctionExpr
Second creates a SECOND function expression to extract second from timestamp
func (*ColumnExpr) Sin ¶
func (c *ColumnExpr) Sin() *FunctionExpr
Sin creates a sine function expression
func (*ColumnExpr) Sqrt ¶
func (c *ColumnExpr) Sqrt() *FunctionExpr
Sqrt creates a square root function expression
func (*ColumnExpr) String ¶
func (c *ColumnExpr) String() string
func (*ColumnExpr) Sub ¶
func (c *ColumnExpr) Sub(other Expr) *BinaryExpr
Sub creates a subtraction expression
func (*ColumnExpr) Substring ¶
func (c *ColumnExpr) Substring(start, length Expr) *FunctionExpr
Substring creates a SUBSTRING function expression
func (*ColumnExpr) Sum ¶
func (c *ColumnExpr) Sum() *AggregationExpr
Sum creates a sum aggregation of this column
func (*ColumnExpr) SupportsContext ¶ added in v0.3.0
func (c *ColumnExpr) SupportsContext(ctx EvaluationContext) bool
SupportsContext returns whether this expression can be evaluated in the given context ColumnExpr can be evaluated in both contexts (but meaning differs)
func (*ColumnExpr) Trim ¶
func (c *ColumnExpr) Trim() *FunctionExpr
Trim creates a TRIM function expression
func (*ColumnExpr) Type ¶
func (c *ColumnExpr) Type() ExprType
func (*ColumnExpr) Upper ¶
func (c *ColumnExpr) Upper() *FunctionExpr
Upper creates an UPPER function expression
func (*ColumnExpr) Year ¶ added in v0.2.0
func (c *ColumnExpr) Year() *FunctionExpr
Year creates a YEAR function expression to extract year from date/time
type ContextualExpr ¶ added in v0.3.0
type ContextualExpr interface {
Expr
// SupportsContext returns whether this expression can be evaluated in the given context
SupportsContext(ctx EvaluationContext) bool
}
ContextualExpr represents expressions that can be evaluated in different contexts
type EvaluationContext ¶ added in v0.3.0
type EvaluationContext int
EvaluationContext represents the context in which an expression is evaluated
const ( // RowContext evaluates expressions against raw row data (for WHERE clauses) RowContext EvaluationContext = iota // GroupContext evaluates expressions against aggregated group data (for HAVING clauses) GroupContext )
func (EvaluationContext) String ¶ added in v0.3.0
func (ec EvaluationContext) String() string
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator evaluates expressions against Arrow arrays
func NewEvaluator ¶
NewEvaluator creates a new expression evaluator
func (*Evaluator) Evaluate ¶
Evaluate evaluates an expression that returns a value array (numeric, string, etc.)
func (*Evaluator) EvaluateBoolean ¶
EvaluateBoolean evaluates an expression that should return a boolean array
func (*Evaluator) EvaluateBooleanWithContext ¶ added in v0.3.0
func (e *Evaluator) EvaluateBooleanWithContext(expr Expr, columns map[string]arrow.Array, ctx EvaluationContext) (arrow.Array, error)
EvaluateBooleanWithContext evaluates an expression that should return a boolean array with context
func (*Evaluator) EvaluateWindow ¶ added in v0.2.0
func (e *Evaluator) EvaluateWindow(expr *WindowExpr, columns map[string]arrow.Array) (arrow.Array, error)
EvaluateWindow evaluates a window expression
type FrameBoundary ¶ added in v0.2.0
type FrameBoundary struct {
// contains filtered or unexported fields
}
FrameBoundary represents a frame boundary
func CurrentRow ¶ added in v0.2.0
func CurrentRow() *FrameBoundary
CurrentRow creates a current row boundary
func Following ¶ added in v0.2.0
func Following(offset int) *FrameBoundary
Following creates a following boundary with offset
func Preceding ¶ added in v0.2.0
func Preceding(offset int) *FrameBoundary
Preceding creates a preceding boundary with offset
func UnboundedFollowing ¶ added in v0.2.0
func UnboundedFollowing() *FrameBoundary
UnboundedFollowing creates an unbounded following boundary
func UnboundedPreceding ¶ added in v0.2.0
func UnboundedPreceding() *FrameBoundary
UnboundedPreceding creates an unbounded preceding boundary
func (*FrameBoundary) String ¶ added in v0.2.0
func (b *FrameBoundary) String() string
String returns the string representation of the boundary
type FunctionExpr ¶
type FunctionExpr struct {
// contains filtered or unexported fields
}
FunctionExpr represents a function call expression
func Coalesce ¶
func Coalesce(exprs ...Expr) *FunctionExpr
Coalesce creates a COALESCE function expression
func DateAdd ¶ added in v0.3.0
func DateAdd(dateExpr Expr, intervalExpr *IntervalExpr) *FunctionExpr
DateAdd creates a DATE_ADD function expression to add interval to date/time
func DateDiff ¶ added in v0.3.0
func DateDiff(startDate, endDate Expr, unit string) *FunctionExpr
DateDiff creates a DATE_DIFF function expression to calculate difference between dates
func DateSub ¶ added in v0.3.0
func DateSub(dateExpr Expr, intervalExpr *IntervalExpr) *FunctionExpr
DateSub creates a DATE_SUB function expression to subtract interval from date/time
func Hour ¶ added in v0.2.0
func Hour(expr Expr) *FunctionExpr
Hour creates an HOUR function expression
func If ¶
func If(condition, thenValue, elseValue Expr) *FunctionExpr
If creates an IF function expression
func Minute ¶ added in v0.2.0
func Minute(expr Expr) *FunctionExpr
Minute creates a MINUTE function expression
func Month ¶ added in v0.2.0
func Month(expr Expr) *FunctionExpr
Month creates a MONTH function expression
func NewFunction ¶ added in v0.3.0
func NewFunction(name string, args ...Expr) *FunctionExpr
NewFunction creates a function expression
func Second ¶ added in v0.2.0
func Second(expr Expr) *FunctionExpr
Second creates a SECOND function expression
func Year ¶ added in v0.2.0
func Year(expr Expr) *FunctionExpr
Year creates a YEAR function expression
func (*FunctionExpr) Abs ¶
func (f *FunctionExpr) Abs() *FunctionExpr
Abs creates an absolute value function expression
func (*FunctionExpr) Add ¶
func (f *FunctionExpr) Add(other Expr) *BinaryExpr
Add creates an addition expression for function expressions
func (*FunctionExpr) And ¶
func (f *FunctionExpr) And(other Expr) *BinaryExpr
func (*FunctionExpr) Args ¶
func (f *FunctionExpr) Args() []Expr
func (*FunctionExpr) CastToBool ¶
func (f *FunctionExpr) CastToBool() *FunctionExpr
func (*FunctionExpr) CastToFloat64 ¶
func (f *FunctionExpr) CastToFloat64() *FunctionExpr
func (*FunctionExpr) CastToInt64 ¶
func (f *FunctionExpr) CastToInt64() *FunctionExpr
func (*FunctionExpr) CastToString ¶
func (f *FunctionExpr) CastToString() *FunctionExpr
CastToString creates a string casting function expression
func (*FunctionExpr) Ceil ¶
func (f *FunctionExpr) Ceil() *FunctionExpr
func (*FunctionExpr) Cos ¶
func (f *FunctionExpr) Cos() *FunctionExpr
func (*FunctionExpr) DateAdd ¶ added in v0.3.0
func (f *FunctionExpr) DateAdd(intervalExpr *IntervalExpr) *FunctionExpr
DateAdd adds an interval to a date/time function result
func (*FunctionExpr) DateSub ¶ added in v0.3.0
func (f *FunctionExpr) DateSub(intervalExpr *IntervalExpr) *FunctionExpr
DateSub subtracts an interval from a date/time function result
func (*FunctionExpr) Day ¶ added in v0.2.0
func (f *FunctionExpr) Day() *FunctionExpr
Day creates a DAY function expression to extract day from date/time
func (*FunctionExpr) Div ¶
func (f *FunctionExpr) Div(other Expr) *BinaryExpr
func (*FunctionExpr) Eq ¶
func (f *FunctionExpr) Eq(other Expr) *BinaryExpr
func (*FunctionExpr) Floor ¶
func (f *FunctionExpr) Floor() *FunctionExpr
func (*FunctionExpr) Ge ¶
func (f *FunctionExpr) Ge(other Expr) *BinaryExpr
func (*FunctionExpr) Gt ¶
func (f *FunctionExpr) Gt(other Expr) *BinaryExpr
func (*FunctionExpr) Hour ¶ added in v0.2.0
func (f *FunctionExpr) Hour() *FunctionExpr
Hour creates an HOUR function expression to extract hour from timestamp
func (*FunctionExpr) Le ¶
func (f *FunctionExpr) Le(other Expr) *BinaryExpr
func (*FunctionExpr) Length ¶
func (f *FunctionExpr) Length() *FunctionExpr
func (*FunctionExpr) Log ¶
func (f *FunctionExpr) Log() *FunctionExpr
func (*FunctionExpr) Lower ¶
func (f *FunctionExpr) Lower() *FunctionExpr
func (*FunctionExpr) Lt ¶
func (f *FunctionExpr) Lt(other Expr) *BinaryExpr
func (*FunctionExpr) Minute ¶ added in v0.2.0
func (f *FunctionExpr) Minute() *FunctionExpr
Minute creates a MINUTE function expression to extract minute from timestamp
func (*FunctionExpr) Month ¶ added in v0.2.0
func (f *FunctionExpr) Month() *FunctionExpr
Month creates a MONTH function expression to extract month from date/time
func (*FunctionExpr) Mul ¶
func (f *FunctionExpr) Mul(other Expr) *BinaryExpr
func (*FunctionExpr) Name ¶
func (f *FunctionExpr) Name() string
func (*FunctionExpr) Ne ¶
func (f *FunctionExpr) Ne(other Expr) *BinaryExpr
func (*FunctionExpr) Neg ¶
func (f *FunctionExpr) Neg() *UnaryExpr
Neg creates a negation expression for function expressions
func (*FunctionExpr) Not ¶
func (f *FunctionExpr) Not() *UnaryExpr
func (*FunctionExpr) Or ¶
func (f *FunctionExpr) Or(other Expr) *BinaryExpr
func (*FunctionExpr) Round ¶
func (f *FunctionExpr) Round() *FunctionExpr
func (*FunctionExpr) RoundTo ¶
func (f *FunctionExpr) RoundTo(precision Expr) *FunctionExpr
func (*FunctionExpr) Second ¶ added in v0.2.0
func (f *FunctionExpr) Second() *FunctionExpr
Second creates a SECOND function expression to extract second from timestamp
func (*FunctionExpr) Sin ¶
func (f *FunctionExpr) Sin() *FunctionExpr
func (*FunctionExpr) Sqrt ¶
func (f *FunctionExpr) Sqrt() *FunctionExpr
func (*FunctionExpr) String ¶
func (f *FunctionExpr) String() string
func (*FunctionExpr) Sub ¶
func (f *FunctionExpr) Sub(other Expr) *BinaryExpr
func (*FunctionExpr) Substring ¶
func (f *FunctionExpr) Substring(start, length Expr) *FunctionExpr
func (*FunctionExpr) SupportsContext ¶ added in v0.3.0
func (f *FunctionExpr) SupportsContext(ctx EvaluationContext) bool
SupportsContext returns whether this expression can be evaluated in the given context FunctionExpr context support depends on its arguments
func (*FunctionExpr) Trim ¶
func (f *FunctionExpr) Trim() *FunctionExpr
func (*FunctionExpr) Type ¶
func (f *FunctionExpr) Type() ExprType
func (*FunctionExpr) Upper ¶
func (f *FunctionExpr) Upper() *FunctionExpr
Upper creates an uppercase function expression
func (*FunctionExpr) Year ¶ added in v0.2.0
func (f *FunctionExpr) Year() *FunctionExpr
Year creates a YEAR function expression to extract year from date/time
type HavingValidator ¶ added in v0.3.0
type HavingValidator struct {
// contains filtered or unexported fields
}
HavingValidator provides validation for HAVING clause expressions. It ensures that HAVING expressions only reference columns that are available in GROUP BY results (either GROUP BY columns or aggregated columns). It supports comprehensive alias resolution for user-defined and default names.
func BuildHavingValidatorWithAlias ¶ added in v0.3.0
func BuildHavingValidatorWithAlias( groupByColumns []string, aggregations []*AggregationExpr, caseInsensitive bool, ) (*HavingValidator, error)
BuildHavingValidatorWithAlias creates a complete HAVING validator with alias resolution from GROUP BY columns and aggregation expressions. This is a convenience function that sets up both the AggregationContext and AliasResolver automatically.
func NewHavingValidator ¶ added in v0.3.0
func NewHavingValidator(aggregationContext *AggregationContext, groupByColumns []string) *HavingValidator
NewHavingValidator creates a new HavingValidator with the given aggregation context and GROUP BY columns. For backward compatibility.
func NewHavingValidatorWithAlias ¶ added in v0.3.0
func NewHavingValidatorWithAlias( aggregationContext *AggregationContext, groupByColumns []string, aliasResolver *AliasResolver, ) *HavingValidator
NewHavingValidatorWithAlias creates a new HavingValidator with enhanced alias resolution. This is the recommended constructor for full HAVING clause functionality.
func (*HavingValidator) GetAvailableAggregations ¶ added in v0.3.0
func (hv *HavingValidator) GetAvailableAggregations() []string
GetAvailableAggregations returns all aggregation expressions available in the context.
func (*HavingValidator) GetAvailableColumns ¶ added in v0.3.0
func (hv *HavingValidator) GetAvailableColumns() []string
GetAvailableColumns returns all columns available in HAVING context (GROUP BY columns + aggregated columns). Uses alias resolver when available.
func (*HavingValidator) ValidateExpression ¶ added in v0.3.0
func (hv *HavingValidator) ValidateExpression(expr Expr) error
ValidateExpression recursively validates a HAVING expression to ensure all column references are valid (either GROUP BY columns or aggregated columns).
type IntervalExpr ¶ added in v0.3.0
type IntervalExpr struct {
// contains filtered or unexported fields
}
IntervalExpr represents a time interval value and type
func Days ¶ added in v0.3.0
func Days(value int64) *IntervalExpr
Days creates an interval representing days
func Hours ¶ added in v0.3.0
func Hours(value int64) *IntervalExpr
Hours creates an interval representing hours
func Minutes ¶ added in v0.3.0
func Minutes(value int64) *IntervalExpr
Minutes creates an interval representing minutes
func Months ¶ added in v0.3.0
func Months(value int64) *IntervalExpr
Months creates an interval representing months
func Years ¶ added in v0.3.0
func Years(value int64) *IntervalExpr
Years creates an interval representing years
func (*IntervalExpr) IntervalType ¶ added in v0.3.0
func (i *IntervalExpr) IntervalType() IntervalType
func (*IntervalExpr) String ¶ added in v0.3.0
func (i *IntervalExpr) String() string
func (*IntervalExpr) SupportsContext ¶ added in v0.3.0
func (i *IntervalExpr) SupportsContext(ctx EvaluationContext) bool
SupportsContext returns whether this expression can be evaluated in the given context IntervalExpr can be evaluated in any context (it's a literal-like expression)
func (*IntervalExpr) Type ¶ added in v0.3.0
func (i *IntervalExpr) Type() ExprType
func (*IntervalExpr) Value ¶ added in v0.3.0
func (i *IntervalExpr) Value() int64
type IntervalType ¶ added in v0.3.0
type IntervalType int
IntervalType represents different types of time intervals
const ( IntervalDays IntervalType = iota IntervalHours IntervalMinutes IntervalMonths IntervalYears )
type InvalidExpr ¶
type InvalidExpr struct {
// contains filtered or unexported fields
}
InvalidExpr represents an invalid expression with an error message
func Invalid ¶
func Invalid(message string) *InvalidExpr
Invalid creates an invalid expression with an error message
func (*InvalidExpr) Message ¶
func (i *InvalidExpr) Message() string
func (*InvalidExpr) String ¶
func (i *InvalidExpr) String() string
func (*InvalidExpr) SupportsContext ¶ added in v0.3.0
func (i *InvalidExpr) SupportsContext(ctx EvaluationContext) bool
SupportsContext returns whether this expression can be evaluated in the given context InvalidExpr cannot be evaluated in any context
func (*InvalidExpr) Type ¶
func (i *InvalidExpr) Type() ExprType
type LiteralExpr ¶
type LiteralExpr struct {
// contains filtered or unexported fields
}
LiteralExpr represents a literal value
func (*LiteralExpr) String ¶
func (l *LiteralExpr) String() string
func (*LiteralExpr) SupportsContext ¶ added in v0.3.0
func (l *LiteralExpr) SupportsContext(ctx EvaluationContext) bool
SupportsContext returns whether this expression can be evaluated in the given context LiteralExpr can be evaluated in any context
func (*LiteralExpr) Type ¶
func (l *LiteralExpr) Type() ExprType
func (*LiteralExpr) Value ¶
func (l *LiteralExpr) Value() interface{}
type OrderByExpr ¶ added in v0.2.0
type OrderByExpr struct {
// contains filtered or unexported fields
}
OrderByExpr represents a column ordering specification
type UnaryExpr ¶
type UnaryExpr struct {
// contains filtered or unexported fields
}
UnaryExpr represents a unary operation
func (*UnaryExpr) SupportsContext ¶ added in v0.3.0
func (u *UnaryExpr) SupportsContext(ctx EvaluationContext) bool
SupportsContext returns whether this expression can be evaluated in the given context UnaryExpr context support depends on its operand
type WindowExpr ¶ added in v0.2.0
type WindowExpr struct {
// contains filtered or unexported fields
}
WindowExpr represents a window function expression
func (*WindowExpr) String ¶ added in v0.2.0
func (w *WindowExpr) String() string
String returns the string representation
func (*WindowExpr) SupportsContext ¶ added in v0.3.0
func (w *WindowExpr) SupportsContext(ctx EvaluationContext) bool
SupportsContext returns whether this expression can be evaluated in the given context WindowExpr typically requires RowContext as it operates on row-level data with window semantics
func (*WindowExpr) Type ¶ added in v0.2.0
func (w *WindowExpr) Type() ExprType
Type returns the expression type
type WindowFrame ¶ added in v0.2.0
type WindowFrame struct {
// contains filtered or unexported fields
}
WindowFrame represents the frame specification for window functions
func Between ¶ added in v0.2.0
func Between(start, end *FrameBoundary) *WindowFrame
Between creates a window frame between two boundaries
func (*WindowFrame) String ¶ added in v0.2.0
func (f *WindowFrame) String() string
String returns the string representation of the frame
type WindowFunctionExpr ¶ added in v0.2.0
type WindowFunctionExpr struct {
// contains filtered or unexported fields
}
WindowFunctionExpr represents a window-specific function (ROW_NUMBER, RANK, etc.)
func DenseRank ¶ added in v0.2.0
func DenseRank() *WindowFunctionExpr
DenseRank creates a DENSE_RANK() window function
func FirstValue ¶ added in v0.2.0
func FirstValue(expr Expr) *WindowFunctionExpr
FirstValue creates a FIRST_VALUE() window function
func Lag ¶ added in v0.2.0
func Lag(expr Expr, offset int) *WindowFunctionExpr
Lag creates a LAG() window function
func LastValue ¶ added in v0.2.0
func LastValue(expr Expr) *WindowFunctionExpr
LastValue creates a LAST_VALUE() window function
func Lead ¶ added in v0.2.0
func Lead(expr Expr, offset int) *WindowFunctionExpr
Lead creates a LEAD() window function
func RowNumber ¶ added in v0.2.0
func RowNumber() *WindowFunctionExpr
RowNumber creates a ROW_NUMBER() window function
func (*WindowFunctionExpr) Over ¶ added in v0.2.0
func (w *WindowFunctionExpr) Over(window *WindowSpec) *WindowExpr
Over creates a window expression with the specified window
func (*WindowFunctionExpr) String ¶ added in v0.2.0
func (w *WindowFunctionExpr) String() string
String returns the string representation
func (*WindowFunctionExpr) SupportsContext ¶ added in v0.3.0
func (w *WindowFunctionExpr) SupportsContext(ctx EvaluationContext) bool
SupportsContext returns whether this expression can be evaluated in the given context WindowFunctionExpr can only be evaluated in RowContext
func (*WindowFunctionExpr) Type ¶ added in v0.2.0
func (w *WindowFunctionExpr) Type() ExprType
Type returns the expression type
type WindowParallelConfig ¶ added in v0.3.0
type WindowParallelConfig struct {
// Minimum number of partitions to trigger parallel execution
MinPartitionsForParallel int
// Minimum rows per partition to trigger parallel sorting
MinRowsForParallelSort int
// Maximum number of workers for window operations
MaxWorkers int
// Enable adaptive parallelization based on data characteristics
AdaptiveParallelization bool
}
WindowParallelConfig holds configuration for parallel window function execution
func DefaultWindowParallelConfig ¶ added in v0.3.0
func DefaultWindowParallelConfig() *WindowParallelConfig
DefaultWindowParallelConfig returns the default configuration for parallel window execution
type WindowSpec ¶ added in v0.2.0
type WindowSpec struct {
// contains filtered or unexported fields
}
WindowSpec represents a window specification for window functions
func NewWindow ¶ added in v0.2.0
func NewWindow() *WindowSpec
NewWindow creates a new window specification
func (*WindowSpec) OrderBy ¶ added in v0.2.0
func (w *WindowSpec) OrderBy(column string, ascending bool) *WindowSpec
OrderBy adds an ordering specification to the window
func (*WindowSpec) PartitionBy ¶ added in v0.2.0
func (w *WindowSpec) PartitionBy(columns ...string) *WindowSpec
PartitionBy sets the partition columns for the window
func (*WindowSpec) Range ¶ added in v0.2.0
func (w *WindowSpec) Range(frame *WindowFrame) *WindowSpec
Range sets a RANGE frame for the window
func (*WindowSpec) Rows ¶ added in v0.2.0
func (w *WindowSpec) Rows(frame *WindowFrame) *WindowSpec
Rows sets a ROWS frame for the window
func (*WindowSpec) String ¶ added in v0.2.0
func (w *WindowSpec) String() string
String returns the string representation of the window spec