expr

package
v0.0.0-...-df06595 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NORMAL = iota
	AGGREGATE
)
View Source
const (
	Not = iota

	Or
	And
	Plus
	Minus
	Mult
	Div
	Mod
	Replace
	Typecast
	RegexpMatch
	RegexpExtract

	EQ
	LT
	LE
	GT
	GE
	NE

	IN

	ISNULL
	ISNOTNULL

	Sum
	Avg
	Min
	Max
	Count
)

Variables

View Source
var ErrDivByZero = errors.New("division by zero")
View Source
var ErrModByZero = errors.New("division by zero")
View Source
var NameOp = map[string]int{
	"not": Not,

	"or":  Or,
	"and": And,
	"+":   Plus,
	"-":   Minus,
	"*":   Mult,
	"/":   Div,
	"%":   Mod,

	"cast": Typecast,

	"replace":        Replace,
	"regexp_match":   RegexpMatch,
	"regexp_extract": RegexpExtract,

	"=":  EQ,
	"<":  LT,
	"<=": LE,
	">":  GT,
	">=": GE,
	"<>": NE,

	"in": IN,

	"isnull":    ISNULL,
	"isnotnull": ISNOTNULL,

	"sum":   Sum,
	"avg":   Avg,
	"min":   Min,
	"max":   Max,
	"count": Count,
}
View Source
var OpName = map[int]string{
	Not: "not",

	Or:    "or",
	And:   "and",
	Plus:  "+",
	Minus: "-",
	Mult:  "*",
	Div:   "/",
	Mod:   "%",

	Replace:       "replace",
	Typecast:      "cast",
	RegexpMatch:   "regexp_match",
	RegexpExtract: "regexp_extract",

	EQ: "=",
	LT: "<",
	LE: "<=",
	GT: ">",
	GE: ">=",
	NE: "<>",

	IN: "in",

	ISNULL:    "isnull",
	ISNOTNULL: "isnotnull",

	Sum:   "sum",
	Avg:   "avg",
	Min:   "min",
	Max:   "max",
	Count: "count",
}

Functions

This section is empty.

Types

type ColExpr

type ColExpr struct {
	// contains filtered or unexported fields
}

func NewColExpr

func NewColExpr(relPos, colPos uint32, typ types.Type) *ColExpr

func (*ColExpr) Dup

func (e *ColExpr) Dup() Expr

func (*ColExpr) Eval

func (e *ColExpr) Eval(bats []*batch.Batch, proc *process.Process) (*vector.Vector, error)

func (*ColExpr) IterateAllColExpr

func (e *ColExpr) IterateAllColExpr(fn func(uint32, uint32) (uint32, uint32))

func (*ColExpr) ResultType

func (e *ColExpr) ResultType() types.Type

func (*ColExpr) Specialize

func (e *ColExpr) Specialize(proc *process.Process) error

func (*ColExpr) SplitBy

func (e *ColExpr) SplitBy(_ uint32) []Expr

func (*ColExpr) String

func (e *ColExpr) String() string

type ConstExpr

type ConstExpr struct {
	// contains filtered or unexported fields
}

func NewConstExpr

func NewConstExpr(isNull bool, val constant.Value) (*ConstExpr, error)

func (*ConstExpr) ConstValue

func (e *ConstExpr) ConstValue() constant.Value

func (*ConstExpr) Dup

func (e *ConstExpr) Dup() Expr

func (*ConstExpr) Eval

func (e *ConstExpr) Eval(_ []*batch.Batch, proc *process.Process) (*vector.Vector, error)

func (*ConstExpr) IterateAllColExpr

func (e *ConstExpr) IterateAllColExpr(fn func(uint32, uint32) (uint32, uint32))

func (*ConstExpr) ResultType

func (e *ConstExpr) ResultType() types.Type

func (*ConstExpr) Specialize

func (e *ConstExpr) Specialize(proc *process.Process) error

func (*ConstExpr) SplitBy

func (e *ConstExpr) SplitBy(_ uint32) []Expr

func (*ConstExpr) String

func (e *ConstExpr) String() string

type Expr

type Expr interface {
	Dup() Expr
	String() string
	ResultType() types.Type
	Specialize(*process.Process) error
	Eval([]*batch.Batch, *process.Process) (*vector.Vector, error)
	// iterate through all expr
	IterateAllColExpr(func(uint32, uint32) (uint32, uint32))

	// slice the expression according to a specific function
	SplitBy(uint32) []Expr
}

type FuncExpr

type FuncExpr struct {
	// contains filtered or unexported fields
}

func NewFuncExpr

func NewFuncExpr(name string, args []Expr) (*FuncExpr, error)

func (*FuncExpr) Dup

func (e *FuncExpr) Dup() Expr

func (*FuncExpr) Eval

func (e *FuncExpr) Eval(bats []*batch.Batch, proc *process.Process) (*vector.Vector, error)

func (*FuncExpr) IterateAllColExpr

func (e *FuncExpr) IterateAllColExpr(fn func(uint32, uint32) (uint32, uint32))

func (*FuncExpr) ResultType

func (e *FuncExpr) ResultType() types.Type

func (*FuncExpr) Specialize

func (e *FuncExpr) Specialize(proc *process.Process) error

func (*FuncExpr) SplitBy

func (e *FuncExpr) SplitBy(op uint32) []Expr

func (*FuncExpr) String

func (e *FuncExpr) String() string

Jump to

Keyboard shortcuts

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