extend

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BinaryReturnTypes = map[int]func(Extend, Extend) types.T{
	overload.Or: func(_ Extend, _ Extend) types.T {
		return types.T_sel
	},
	overload.And: func(_ Extend, _ Extend) types.T {
		return types.T_sel
	},
	overload.EQ: func(_ Extend, _ Extend) types.T {
		return types.T_sel
	},
	overload.NE: func(_ Extend, _ Extend) types.T {
		return types.T_sel
	},
	overload.LT: func(_ Extend, _ Extend) types.T {
		return types.T_sel
	},
	overload.LE: func(_ Extend, _ Extend) types.T {
		return types.T_sel
	},
	overload.GT: func(_ Extend, _ Extend) types.T {
		return types.T_sel
	},
	overload.GE: func(_ Extend, _ Extend) types.T {
		return types.T_sel
	},
	overload.Like: func(_ Extend, _ Extend) types.T {
		return types.T_sel
	},
	overload.NotLike: func(_ Extend, _ Extend) types.T {
		return types.T_sel
	},
	overload.Typecast: func(_ Extend, r Extend) types.T {
		return r.ReturnType()
	},
	overload.Plus: func(l Extend, r Extend) types.T {
		return overload.GetBinOpReturnType(overload.Plus, l.ReturnType(), r.ReturnType())
	},
	overload.Minus: func(l Extend, r Extend) types.T {
		return overload.GetBinOpReturnType(overload.Minus, l.ReturnType(), r.ReturnType())
	},
	overload.Mult: func(l Extend, r Extend) types.T {
		return overload.GetBinOpReturnType(overload.Mult, l.ReturnType(), r.ReturnType())
	},
	overload.Div: func(l Extend, r Extend) types.T {
		return overload.GetBinOpReturnType(overload.Div, l.ReturnType(), r.ReturnType())
	},
	overload.IntegerDiv: func(l Extend, r Extend) types.T {
		return overload.GetBinOpReturnType(overload.IntegerDiv, l.ReturnType(), r.ReturnType())
	},
	overload.Mod: func(l Extend, r Extend) types.T {
		return overload.GetBinOpReturnType(overload.Mod, l.ReturnType(), r.ReturnType())
	},
}
View Source
var BinaryStrings = map[int]func(Extend, Extend) string{
	overload.Like: func(l Extend, r Extend) string {
		return fmt.Sprintf("like(%s, %s)", l.String(), r.String())
	},
	overload.NotLike: func(l Extend, r Extend) string {
		return fmt.Sprintf("notLike(%s, %s)", l.String(), r.String())
	},
	overload.EQ: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s = %s", l.String(), r.String())
	},
	overload.LT: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s < %s", l.String(), r.String())
	},
	overload.GT: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s > %s", l.String(), r.String())
	},
	overload.LE: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s <= %s", l.String(), r.String())
	},
	overload.GE: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s >= %s", l.String(), r.String())
	},
	overload.NE: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s <> %s", l.String(), r.String())
	},
	overload.Or: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s or %s", l.String(), r.String())
	},
	overload.And: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s and %s", l.String(), r.String())
	},
	overload.Div: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s / %s", l.String(), r.String())
	},
	overload.IntegerDiv: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s div %s", l.String(), r.String())
	},
	overload.Mod: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s %% %s", l.String(), r.String())
	},
	overload.Plus: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s + %s", l.String(), r.String())
	},
	overload.Mult: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s * %s", l.String(), r.String())
	},
	overload.Minus: func(l Extend, r Extend) string {
		return fmt.Sprintf("%s - %s", l.String(), r.String())
	},
	overload.Typecast: func(l Extend, r Extend) string {
		return fmt.Sprintf("cast(%s as %s)", l.String(), r.ReturnType())
	},
}
View Source
var FunctionRegistry = map[string]int{}
View Source
var MultiReturnTypes = map[int]func([]Extend) types.T{}
View Source
var MultiStrings = map[int]func([]Extend) string{}
View Source
var UnaryReturnTypes = map[int]func(Extend) types.T{
	overload.UnaryMinus: func(e Extend) types.T {
		return e.ReturnType()
	},
	overload.Not: func(e Extend) types.T {
		return overload.GetUnaryOpReturnType(overload.Not, e.ReturnType())
	},
}
View Source
var UnaryStrings = map[int]func(Extend) string{
	overload.UnaryMinus: func(e Extend) string {
		return "-" + e.String()
	},
	overload.Not: func(e Extend) string {
		return fmt.Sprintf("not(%s)", e)
	},
}

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Name string  `json:"name"`
	Type types.T `json:"type"`
}

func (*Attribute) Attributes

func (a *Attribute) Attributes() []string

func (*Attribute) Eq

func (a *Attribute) Eq(e Extend) bool

func (*Attribute) Eval

func (a *Attribute) Eval(bat *batch.Batch, _ *process.Process) (*vector.Vector, types.T, error)

func (*Attribute) ExtendAttributes

func (a *Attribute) ExtendAttributes() []*Attribute

func (*Attribute) IsConstant

func (_ *Attribute) IsConstant() bool

func (*Attribute) IsLogical

func (a *Attribute) IsLogical() bool

func (*Attribute) ReturnType

func (a *Attribute) ReturnType() types.T

func (*Attribute) String

func (a *Attribute) String() string

type BinaryExtend

type BinaryExtend struct {
	Op          int
	Left, Right Extend
}

func (*BinaryExtend) Attributes

func (e *BinaryExtend) Attributes() []string

func (*BinaryExtend) Eq

func (a *BinaryExtend) Eq(e Extend) bool

func (*BinaryExtend) Eval

func (e *BinaryExtend) Eval(bat *batch.Batch, proc *process.Process) (*vector.Vector, types.T, error)

func (*BinaryExtend) ExtendAttributes

func (e *BinaryExtend) ExtendAttributes() []*Attribute

func (*BinaryExtend) IsConstant

func (_ *BinaryExtend) IsConstant() bool

func (*BinaryExtend) IsLogical

func (e *BinaryExtend) IsLogical() bool

func (*BinaryExtend) ReturnType

func (e *BinaryExtend) ReturnType() types.T

func (*BinaryExtend) String

func (e *BinaryExtend) String() string

type Extend

type Extend interface {
	Eq(Extend) bool
	String() string
	IsLogical() bool
	IsConstant() bool
	ReturnType() types.T
	Attributes() []string
	ExtendAttributes() []*Attribute
	Eval(*batch.Batch, *process.Process) (*vector.Vector, types.T, error)
}

func AndExtends

func AndExtends(e Extend, es []Extend) []Extend

type FuncExtend

type FuncExtend struct {
	Name string
	Args []Extend
}

func (*FuncExtend) Attributes

func (a *FuncExtend) Attributes() []string

func (*FuncExtend) Eq

func (a *FuncExtend) Eq(e Extend) bool

func (*FuncExtend) Eval

func (a *FuncExtend) Eval(_ *batch.Batch, _ *process.Process) (*vector.Vector, types.T, error)

func (*FuncExtend) ExtendAttributes

func (a *FuncExtend) ExtendAttributes() []*Attribute

func (*FuncExtend) IsConstant

func (_ *FuncExtend) IsConstant() bool

func (*FuncExtend) IsLogical

func (_ *FuncExtend) IsLogical() bool

func (*FuncExtend) ReturnType

func (a *FuncExtend) ReturnType() types.T

func (*FuncExtend) String

func (a *FuncExtend) String() string

type MultiExtend

type MultiExtend struct {
	Op   int
	Args []Extend
}

func (*MultiExtend) Attributes

func (e *MultiExtend) Attributes() []string

func (*MultiExtend) Eq

func (a *MultiExtend) Eq(e Extend) bool

func (*MultiExtend) Eval

func (e *MultiExtend) Eval(bat *batch.Batch, proc *process.Process) (*vector.Vector, types.T, error)

func (*MultiExtend) ExtendAttributes

func (e *MultiExtend) ExtendAttributes() []*Attribute

func (*MultiExtend) IsConstant

func (_ *MultiExtend) IsConstant() bool

func (*MultiExtend) IsLogical

func (e *MultiExtend) IsLogical() bool

func (*MultiExtend) ReturnType

func (e *MultiExtend) ReturnType() types.T

func (*MultiExtend) String

func (e *MultiExtend) String() string

type ParenExtend

type ParenExtend struct {
	E Extend
}

func (*ParenExtend) Attributes

func (e *ParenExtend) Attributes() []string

func (*ParenExtend) Eq

func (a *ParenExtend) Eq(b Extend) bool

func (*ParenExtend) Eval

func (e *ParenExtend) Eval(bat *batch.Batch, proc *process.Process) (*vector.Vector, types.T, error)

func (*ParenExtend) ExtendAttributes

func (e *ParenExtend) ExtendAttributes() []*Attribute

func (*ParenExtend) IsConstant

func (_ *ParenExtend) IsConstant() bool

func (*ParenExtend) IsLogical

func (e *ParenExtend) IsLogical() bool

func (*ParenExtend) ReturnType

func (e *ParenExtend) ReturnType() types.T

func (*ParenExtend) String

func (e *ParenExtend) String() string

type StarExtend

type StarExtend struct {
}

func (*StarExtend) Attributes

func (a *StarExtend) Attributes() []string

func (*StarExtend) Eq

func (a *StarExtend) Eq(e Extend) bool

func (*StarExtend) Eval

func (a *StarExtend) Eval(_ *batch.Batch, _ *process.Process) (*vector.Vector, types.T, error)

func (*StarExtend) ExtendAttributes

func (a *StarExtend) ExtendAttributes() []*Attribute

func (*StarExtend) IsConstant

func (_ *StarExtend) IsConstant() bool

func (*StarExtend) IsLogical

func (_ *StarExtend) IsLogical() bool

func (*StarExtend) ReturnType

func (a *StarExtend) ReturnType() types.T

func (*StarExtend) String

func (a *StarExtend) String() string

type UnaryExtend

type UnaryExtend struct {
	Op int
	E  Extend
}

func (*UnaryExtend) Attributes

func (e *UnaryExtend) Attributes() []string

func (*UnaryExtend) Eq

func (a *UnaryExtend) Eq(e Extend) bool

func (*UnaryExtend) Eval

func (e *UnaryExtend) Eval(bat *batch.Batch, proc *process.Process) (*vector.Vector, types.T, error)

func (*UnaryExtend) ExtendAttributes

func (e *UnaryExtend) ExtendAttributes() []*Attribute

func (*UnaryExtend) IsConstant

func (_ *UnaryExtend) IsConstant() bool

func (*UnaryExtend) IsLogical

func (e *UnaryExtend) IsLogical() bool

func (*UnaryExtend) ReturnType

func (e *UnaryExtend) ReturnType() types.T

func (*UnaryExtend) String

func (e *UnaryExtend) String() string

type UpdateExtend

type UpdateExtend struct {
	// CanNull	   bool
	Attr         Attribute
	UpdateExtend Extend
}

func (*UpdateExtend) Attributes

func (_ *UpdateExtend) Attributes() []string

func (*UpdateExtend) Eq

func (p *UpdateExtend) Eq(e Extend) bool

func (*UpdateExtend) Eval

func (p *UpdateExtend) Eval(bat *batch.Batch, proc *process.Process) (*vector.Vector, types.T, error)

func (*UpdateExtend) IsConstant

func (_ *UpdateExtend) IsConstant() bool

func (*UpdateExtend) IsLogical

func (p *UpdateExtend) IsLogical() bool

func (*UpdateExtend) ReturnType

func (p *UpdateExtend) ReturnType() types.T

func (*UpdateExtend) String

func (p *UpdateExtend) String() string

type ValueExtend

type ValueExtend struct {
	V       *vector.Vector
	OrigStr string
}

func (*ValueExtend) Attributes

func (_ *ValueExtend) Attributes() []string

func (*ValueExtend) Eq

func (a *ValueExtend) Eq(e Extend) bool

func (*ValueExtend) Eval

func (a *ValueExtend) Eval(_ *batch.Batch, _ *process.Process) (*vector.Vector, types.T, error)

func (*ValueExtend) ExtendAttributes

func (_ *ValueExtend) ExtendAttributes() []*Attribute

func (*ValueExtend) IsConstant

func (_ *ValueExtend) IsConstant() bool

func (*ValueExtend) IsLogical

func (a *ValueExtend) IsLogical() bool

func (*ValueExtend) ReturnType

func (a *ValueExtend) ReturnType() types.T

func (*ValueExtend) String

func (a *ValueExtend) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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