compute

package
v0.0.0-...-10cc69c Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package compute provides core computation functionality

Index

Constants

View Source
const (
	LOAD_FACTOR = 1.5
	HASH_WIDTH  = 8
	BLOCK_SIZE  = 256*1024 - 8
)
View Source
const (
	NoneSide       = 0
	LeftSide       = 1 << 1
	RightSide      = 1 << 2
	BothSide       = LeftSide | RightSide
	CorrelatedSide = 1 << 3
)
View Source
const (
	ExplainOptionAnalyze     = 1
	ExplainOptionVerbose     = 2
	ExplainOptionCosts       = 3
	ExplainOptionSettings    = 4
	ExplainOptionGenericPlan = 5
	ExplainOptionBuffers     = 6
	ExplainOptionSerialize   = 7
	ExplainOptionWal         = 8
	ExplainOptionTiming      = 9
	ExplainOptionSummary     = 10
	ExplainOptionMemory      = 11
	ExplainOptionFormat      = 12

	ExplainSerializeNone   = 0
	ExplainSerializeText   = 1
	ExplainSerializeBinary = 2

	ExplainFormatText = 0
	ExplainFormatJSON = 1
	ExplainFormatYAML = 2
	ExplainFormatXML  = 3
)
View Source
const (
	// 算术运算符
	FuncAdd      = "+"
	FuncSubtract = "-"
	FuncMultiply = "*"
	FuncDivide   = "/"

	// 比较运算符
	FuncEqual        = "="
	FuncNotEqual     = "<>"
	FuncGreater      = ">"
	FuncGreaterEqual = ">="
	FuncLess         = "<"
	FuncLessEqual    = "<="

	// 逻辑运算符
	FuncAnd = "and"
	FuncOr  = "or"
	FuncNot = "not"

	// 字符串运算符
	FuncLike    = "like"
	FuncNotLike = "not like"

	// 其它运算符
	FuncBetween   = "between"
	FuncCase      = "case"
	FuncCaseWhen  = "case when"
	FuncIn        = "in"
	FuncNotIn     = "not in"
	FuncExists    = "exists"
	FuncNotExists = "not exists"

	// 函数
	FuncDateAdd   = "date_add"
	FuncDateSub   = "date_sub"
	FuncCast      = "cast"
	FuncExtract   = "extract"
	FuncSubstring = "substring"
)
View Source
const (
	DecimalBindData    = "decimal"
	DecimalNegBindData = "decimalNeg"
)
View Source
const (
	VALUES_PER_RADIX              = 256
	MSD_RADIX_LOCATIONS           = VALUES_PER_RADIX + 1
	INSERTION_SORT_THRESHOLD      = 24
	MSD_RADIX_SORT_SIZE_THRESHOLD = 4
)
View Source
const (
	INVALID_INDEX uint32 = math.MaxUint32
)

Variables

View Source
var ExplainOptionNames = []string{
	"Invalid Explain Option",
	"Analyze",
	"Verbose",
	"Costs",
	"Settings",
	"GenericPlan",
	"Buffers",
	"Serialize",
	"Wal",
	"Timing",
	"Summary",
	"Memory",
	"Format",
}

Functions

func AddInPlace

func AddInPlace(input *chunk.Vector, right int64, cnt int)

AddInPlace left += delta

func And

func And(left, right, result *chunk.Vector, count int)

func AnyTies

func AnyTies(ties []bool, count int) bool

func BSWAP16

func BSWAP16(x uint16) uint16

func BSWAP32

func BSWAP32(x uint32) uint32

func BSWAP64

func BSWAP64(x uint64) uint64

func ColumnDataCopySwitch

func ColumnDataCopySwitch(
	metaData *ColumnDataMetaData,
	srcData *chunk.UnifiedFormat,
	src *chunk.Vector,
	offset int,
	count int,
)

func Combine

func Combine[ResultT any, STATE State[ResultT], InputT any, OP AggrOp[ResultT, InputT]](
	source *chunk.Vector,
	target *chunk.Vector,
	data *AggrInputData,
	count int,
	aop AggrOp[ResultT, InputT],
	sop StateOp[ResultT],
	addOp AddOp[ResultT, InputT],
	top TypeOp[ResultT],
)

func CompareVal

func CompareVal(
	lPtr, rPtr unsafe.Pointer,
	typ common.LType,
) int

func ComputeStringEntrySizes

func ComputeStringEntrySizes(
	col *chunk.UnifiedFormat,
	entrySizes []int,
	sel *chunk.SelectVector,
	count int,
	offset int,
)

func ComputeTies

func ComputeTies(
	dataPtr unsafe.Pointer,
	count int,
	colOffset int,
	tieSize int,
	ties []bool,
	layout *SortLayout)

func EncodeStringDataPrefix

func EncodeStringDataPrefix(
	dataPtr unsafe.Pointer,
	value *common.String,
	prefixLen int)

func EntriesPerBlock

func EntriesPerBlock(width int) int

func ExplainLogicalPlan

func ExplainLogicalPlan(root *LogicalOperator) (string, error)

func ExplainPhysicalPlan

func ExplainPhysicalPlan(root *PhysicalOperator) (string, error)

func FillSwitch

func FillSwitch(
	vec *chunk.Vector,
	res *chunk.Vector,
	sel *chunk.SelectVector,
	count int,
)

func Finalize

func Finalize[ResultT any, STATE State[ResultT], InputT any, OP AggrOp[ResultT, InputT]](
	states *chunk.Vector,
	data *AggrInputData,
	result *chunk.Vector,
	count int,
	offset int,
	aop AggrOp[ResultT, InputT],
	sop StateOp[ResultT],
	addOp AddOp[ResultT, InputT],
	top TypeOp[ResultT],
)

func FinalizeStates

func FinalizeStates(
	layout *TupleDataLayout,
	addresses *chunk.Vector,
	result *chunk.Chunk,
	aggrIdx int,
)

func FindSubgraphMatchAndMerge

func FindSubgraphMatchAndMerge(mergeTo *Subgraph2Denominator,
	findMe uint64,
	next int,
	subgraphs []*Subgraph2Denominator)

func FlipSign

func FlipSign(b uint8) uint8

func Gather

func Gather(
	rows *chunk.Vector,
	rowSel *chunk.SelectVector,
	col *chunk.Vector,
	colSel *chunk.SelectVector,
	count int,
	layout *RowLayout,
	colNo int,
	buildSize int,
	heapPtr unsafe.Pointer,
)

func GatherVarchar

func GatherVarchar(
	rows *chunk.Vector,
	rowSel *chunk.SelectVector,
	col *chunk.Vector,
	colSel *chunk.SelectVector,
	count int,
	layout *RowLayout,
	colNo int,
	buildSize int,
	baseHeapPtr unsafe.Pointer,
)

func GetDistinctIndices

func GetDistinctIndices(aggregates []*Expr) []int

func GetTmp

func GetTmp(src unsafe.Pointer, constants *PDQConstants) unsafe.Pointer

func InitStates

func InitStates(
	layout *TupleDataLayout,
	addresses *chunk.Vector,
	sel *chunk.SelectVector,
	cnt int,
)

func InsertHashesLoop

func InsertHashesLoop(
	pointers []unsafe.Pointer,
	indices []uint64,
	cnt int,
	keyLocs []unsafe.Pointer,
	pointerOffset int,
)

func InsertionSort

func InsertionSort(
	origPtr unsafe.Pointer,
	tempPtr unsafe.Pointer,
	count int,
	colOffset int,
	rowWidth int,
	totalCompWidth int,
	offset int,
	swap bool,
)

InsertionSort adapted in less count of values

func IsAgg

func IsAgg(name string) bool

func IsLogicalFilter

func IsLogicalFilter(op *LogicalOperator) bool

func IsOperator

func IsOperator(name string) bool

func Match

func Match(
	columns *chunk.Chunk,
	colData []*chunk.UnifiedFormat,
	layout *TupleDataLayout,
	rows *chunk.Vector,
	predicates []string,
	sel *chunk.SelectVector,
	cnt int,
	noMatch *chunk.SelectVector,
	noMatchCnt *int,
) int

func Move

func Move(dst, src unsafe.Pointer, constants *PDQConstants)

func NoCast

func NoCast(src *chunk.Vector, res *chunk.Vector, count int, params *CastParams) bool

func RadixScatter

func RadixScatter(
	v *chunk.Vector,
	vcount int,
	sel *chunk.SelectVector,
	serCount int,
	keyLocs []unsafe.Pointer,
	desc bool,
	hasNull bool,
	nullsFirst bool,
	prefixLen int,
	width int,
	offset int,
)

func RadixScatterStringVector

func RadixScatterStringVector(
	vdata *chunk.UnifiedFormat,
	sel *chunk.SelectVector,
	addCount int,
	keyLocs []unsafe.Pointer,
	desc bool,
	hasNull bool,
	nullsFirst bool,
	prefixLen int,
	offset int,
)

func RadixSort

func RadixSort(
	dataPtr unsafe.Pointer,
	count int,
	colOffset int,
	sortingSize int,
	sortLayout *SortLayout,
	containsString bool,
)

func RadixSortLSD

func RadixSortLSD(
	dataPtr unsafe.Pointer,
	count int,
	colOffset int,
	rowWidth int,
	sortingSize int,
)

func RadixSortMSD

func RadixSortMSD(
	origPtr unsafe.Pointer,
	tempPtr unsafe.Pointer,
	count int,
	colOffset int,
	rowWidth int,
	compWidth int,
	offset int,
	locations []uint64,
	swap bool,
)

func RegisterAggrs

func RegisterAggrs()

func RegisterOps

func RegisterOps()

func Run

func Run(cfg *util.Config) error

func RunDDL

func RunDDL(cfg *util.Config) error

func ScalarNopFunc

func ScalarNopFunc(input *chunk.Chunk, state *ExprState, result *chunk.Vector)

func Scatter

func Scatter(
	columns *chunk.Chunk,
	colData []*chunk.UnifiedFormat,
	layout *RowLayout,
	rows *chunk.Vector,
	stringHeap *RowDataCollection,
	sel *chunk.SelectVector,
	count int,
)

func ScatterStringVector

func ScatterStringVector(
	col *chunk.UnifiedFormat,
	rows *chunk.Vector,
	strLocs []unsafe.Pointer,
	sel *chunk.SelectVector,
	count int,
	colOffset int,
	colNo int,
	layout *RowLayout,
)

func SortTiedBlobs

func SortTiedBlobs(
	sb *SortedBlock,
	ties []bool,
	dataPtr unsafe.Pointer,
	count int,
	tieCol int,
	layout *SortLayout)

func SortTiedBlobs2

func SortTiedBlobs2(
	dataPtr unsafe.Pointer,
	start int,
	end int,
	tieCol int,
	ties []bool,
	blobPtr unsafe.Pointer,
	layout *SortLayout,
)

func StateSize

func StateSize[T any, STATE State[T]]() int

func SubSortTiedTuples

func SubSortTiedTuples(
	dataPtr unsafe.Pointer,
	count int,
	colOffset int,
	sortingSize int,
	ties []bool,
	layout *SortLayout,
	containsString bool)

func SwapOffsetsGetTmp

func SwapOffsetsGetTmp(src unsafe.Pointer, constants *PDQConstants) unsafe.Pointer

func TemplatedColumnDataCopy

func TemplatedColumnDataCopy[T any](
	metaData *ColumnDataMetaData,
	srcData *chunk.UnifiedFormat,
	src *chunk.Vector,
	offset int,
	count int,
	cp BaseValueCopy[T],
)

func TemplatedCompareVal

func TemplatedCompareVal[T any](
	lPtr, rPtr unsafe.Pointer,
	equalOp BinaryOp[T, T, bool],
	lessOp BinaryOp[T, T, bool],
) int

func TemplatedFillLoop

func TemplatedFillLoop[T any](
	vec *chunk.Vector,
	res *chunk.Vector,
	sel *chunk.SelectVector,
	count int,
)

func TemplatedGatherLoop

func TemplatedGatherLoop[T any](
	rows *chunk.Vector,
	rowSel *chunk.SelectVector,
	col *chunk.Vector,
	colSel *chunk.SelectVector,
	count int,
	layout *RowLayout,
	colNo int,
	buildSize int,
)

func TemplatedMatch

func TemplatedMatch(
	columns *chunk.Chunk,
	colData []*chunk.UnifiedFormat,
	layout *TupleDataLayout,
	rows *chunk.Vector,
	predicates []string,
	sel *chunk.SelectVector,
	cnt *int,
	noMatch *chunk.SelectVector,
	noMatchCnt *int,
	noMatchSel bool,
)

func TemplatedMatchOp

func TemplatedMatchOp(
	vec *chunk.Vector,
	col *chunk.UnifiedFormat,
	predTyp string,
	layout *TupleDataLayout,
	rows *chunk.Vector,
	sel *chunk.SelectVector,
	cnt *int,
	colNo int,
	noMatch *chunk.SelectVector,
	noMatchCnt *int,
	originalCnt int,
	noMatchSel bool,
)

func TemplatedMatchType

func TemplatedMatchType[T any](
	col *chunk.UnifiedFormat,
	rows *chunk.Vector,
	rowWidth int,
	sel *chunk.SelectVector,
	cnt *int,
	colOffset int,
	colNo int,
	noMatch *chunk.SelectVector,
	noMatchCnt *int,
	noMatchSel bool,
	cmp CompareOp[T],
)

func TemplatedRadixScatter

func TemplatedRadixScatter[T any](
	vdata *chunk.UnifiedFormat,
	sel *chunk.SelectVector,
	addCount int,
	keyLocs []unsafe.Pointer,
	desc bool,
	hasNull bool,
	nullsFirst bool,
	offset int,
	enc Encoder[T],
)

func TemplatedScatter

func TemplatedScatter[T any](
	col *chunk.UnifiedFormat,
	rows *chunk.Vector,
	sel *chunk.SelectVector,
	count int,
	colOffset int,
	colNo int,
	layout *RowLayout,
	sop chunk.ScatterOp[T],
)

func TemplatedTryCastLoop

func TemplatedTryCastLoop[T any, R any](
	src, res *chunk.Vector,
	count int,
	params *CastParams,
	op UnaryOp2[T, R],
) bool

func TieIsBreakable

func TieIsBreakable(
	tieCol int,
	rowPtr unsafe.Pointer,
	layout *SortLayout,
) bool

func TryCastLoop

func TryCastLoop[T any, R any](
	src, res *chunk.Vector,
	count int,
	params *CastParams,
	op CastOp[T, R],
) bool

func TupleDataTemplatedGather

func TupleDataTemplatedGather[T any](
	layout *TupleDataLayout,
	rowLocs *chunk.Vector,
	colIdx int,
	scanSel *chunk.SelectVector,
	scanCnt int,
	target *chunk.Vector,
	targetSel *chunk.SelectVector,
)

func TupleDataTemplatedGatherSwitch

func TupleDataTemplatedGatherSwitch(
	layout *TupleDataLayout,
	rowLocs *chunk.Vector,
	colIdx int,
	scanSel *chunk.SelectVector,
	scanCnt int,
	target *chunk.Vector,
	targetSel *chunk.SelectVector,
)

func TupleDataTemplatedScatter

func TupleDataTemplatedScatter[T any](
	srcFormat *chunk.UnifiedFormat,
	appendSel *chunk.SelectVector,
	cnt int,
	layout *TupleDataLayout,
	rowLocations *chunk.Vector,
	heapLocations *chunk.Vector,
	colIdx int,
	nVal chunk.ScatterOp[T],
)

func TupleDataTemplatedScatterSwitch

func TupleDataTemplatedScatterSwitch(
	src *chunk.Vector,
	srcFormat *chunk.UnifiedFormat,
	appendSel *chunk.SelectVector,
	cnt int,
	layout *TupleDataLayout,
	rowLocations *chunk.Vector,
	heapLocations *chunk.Vector,
	colIdx int)

func TupleDataValueStore

func TupleDataValueStore[T any](src T, rowLoc unsafe.Pointer, offsetInRow int, heapLoc *unsafe.Pointer, nVal chunk.ScatterOp[T])

func UnaryExecuteStandard

func UnaryExecuteStandard[T any, R any](
	input, result *chunk.Vector,
	count int,
	data *UnaryData,
	addNulls bool)

func UnaryFlatLoop

func UnaryFlatLoop[ResultT any, STATE State[ResultT], InputT any, OP AggrOp[ResultT, InputT]](
	inputSlice []InputT,
	data *AggrInputData,
	statesPtrSlice []unsafe.Pointer,
	mask *util.Bitmap,
	count int,
	aop AggrOp[ResultT, InputT],
	sop StateOp[ResultT],
	addOp AddOp[ResultT, InputT],
	top TypeOp[ResultT],
)

func UnaryFlatUpdateLoop

func UnaryFlatUpdateLoop[ResultT any, STATE State[ResultT], InputT any, OP AggrOp[ResultT, InputT]](
	inputSlice []InputT,
	data *AggrInputData,
	statePtr unsafe.Pointer,
	count int,
	mask *util.Bitmap,
	aop AggrOp[ResultT, InputT],
	sop StateOp[ResultT],
	addOp AddOp[ResultT, InputT],
	top TypeOp[ResultT],
)

func UnaryScatter

func UnaryScatter[ResultT any, STATE State[ResultT], InputT any, OP AggrOp[ResultT, InputT]](
	input *chunk.Vector,
	states *chunk.Vector,
	data *AggrInputData,
	count int,
	aop AggrOp[ResultT, InputT],
	sop StateOp[ResultT],
	addOp AddOp[ResultT, InputT],
	top TypeOp[ResultT],
)

func UnaryScatterLoop

func UnaryScatterLoop[ResultT any, STATE State[ResultT], InputT any](
	inputSlice []InputT,
	data *AggrInputData,
	statesPtrSlice []unsafe.Pointer,
	isel *chunk.SelectVector,
	ssel *chunk.SelectVector,
	mask *util.Bitmap,
	count int,
	aop AggrOp[ResultT, InputT],
	sop StateOp[ResultT],
	addOp AddOp[ResultT, InputT],
	top TypeOp[ResultT],
)

func UnaryUpdate

func UnaryUpdate[ResultT any, STATE State[ResultT], InputT any, OP AggrOp[ResultT, InputT]](
	input *chunk.Vector,
	data *AggrInputData,
	statePtr unsafe.Pointer,
	count int,
	aop AggrOp[ResultT, InputT],
	sop StateOp[ResultT],
	addOp AddOp[ResultT, InputT],
	top TypeOp[ResultT],
)

func UnaryUpdateLoop

func UnaryUpdateLoop[ResultT any, STATE State[ResultT], InputT any, OP AggrOp[ResultT, InputT]](
	inputSlice []InputT,
	data *AggrInputData,
	statePtr unsafe.Pointer,
	count int,
	mask *util.Bitmap,
	selVec *chunk.SelectVector,
	aop AggrOp[ResultT, InputT],
	sop StateOp[ResultT],
	addOp AddOp[ResultT, InputT],
	top TypeOp[ResultT],
)

func UpdateDenom

func UpdateDenom(rel2Dem *Subgraph2Denominator, rel2TDom *RelationToTDom)

func UpdateStates

func UpdateStates(
	aggr *AggrObject,
	addresses *chunk.Vector,
	payload *chunk.Chunk,
	argIdx int,
	cnt int,
)

func VectorTryCastOperator

func VectorTryCastOperator[T, R any](
	input *T,
	result *R,
	mask *util.Bitmap,
	idx int,
	data *UnaryData,
	op CastOp[T, R])

func WildcardMatch

func WildcardMatch(pattern, target *common.String) bool

WildcardMatch implements wildcard pattern match algorithm. pattern and target are ascii characters TODO: add \_ and \%

func WriteExpr

func WriteExpr(ctx *FormatCtx, expr *Expr)

func WriteExprTree

func WriteExprTree(tree treeprint.Tree, expr *Expr)

func WriteExprs

func WriteExprs(ctx *FormatCtx, exprs []*Expr)

func WriteExprsTree

func WriteExprsTree(tree treeprint.Tree, exprs []*Expr)

func WriteMap

func WriteMap[K comparable, V any](ctx *FormatCtx, m map[K]V)

func WriteMapTree

func WriteMapTree[K comparable, V any](tree treeprint.Tree, m map[K]V)

Types

type AddFunc

type AddFunc struct {
}

func (AddFunc) Func

func (add AddFunc) Func(typ common.LType) *Function

func (AddFunc) Func2

func (add AddFunc) Func2(lTyp, rTyp common.LType) *Function

func (AddFunc) Register

func (add AddFunc) Register(funcList FunctionList)

type AddOp

type AddOp[ResultT any, InputT any] interface {
	AddNumber(*State[ResultT], *InputT, TypeOp[ResultT])
	AddConstant(*State[ResultT], *InputT, int, TypeOp[ResultT])
	Assign(*State[ResultT], *InputT)
	Execute(*State[ResultT], *InputT, TypeOp[ResultT])
}

type AggrFinalizeData

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

func NewAggrFinalizeData

func NewAggrFinalizeData(result *chunk.Vector, input *AggrInputData) *AggrFinalizeData

func (*AggrFinalizeData) ReturnNull

func (data *AggrFinalizeData) ReturnNull()

type AggrHTAppendState

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

func NewAggrHTAppendState

func NewAggrHTAppendState() *AggrHTAppendState

type AggrInputData

type AggrInputData struct {
}

func NewAggrInputData

func NewAggrInputData() *AggrInputData

type AggrObject

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

func CreateAggrObjects

func CreateAggrObjects(aggregates []*Expr) []*AggrObject

func NewAggrObject

func NewAggrObject(aggr *Expr) *AggrObject

type AggrOp

type AggrOp[ResultT any, InputT any] interface {
	Init(*State[ResultT], StateOp[ResultT])
	Combine(*State[ResultT], *State[ResultT], *AggrInputData, StateOp[ResultT], TypeOp[ResultT])
	Operation(*State[ResultT], *InputT, *AggrUnaryInput, StateOp[ResultT], AddOp[ResultT, InputT], TypeOp[ResultT])
	ConstantOperation(*State[ResultT], *InputT, *AggrUnaryInput, int, StateOp[ResultT], AddOp[ResultT, InputT], TypeOp[ResultT])
	Finalize(*State[ResultT], *ResultT, *AggrFinalizeData)
	IgnoreNull() bool
}

type AggrType

type AggrType int
const (
	NON_DISTINCT AggrType = iota
	DISTINCT
)

type AggrUnaryInput

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

func NewAggrUnaryInput

func NewAggrUnaryInput(input *AggrInputData, mask *util.Bitmap) *AggrUnaryInput

type AndOp

type AndOp struct {
}

type AvgFunc

type AvgFunc struct {
}

func (AvgFunc) Register

func (AvgFunc) Register(funcList FunctionList)

type AvgOp

type AvgOp[ResultT any, InputT any] struct {
}

func (AvgOp[ResultT, InputT]) Combine

func (AvgOp[ResultT, InputT]) Combine(
	src *State[ResultT],
	target *State[ResultT],
	data *AggrInputData,
	sop StateOp[ResultT],
	top TypeOp[ResultT])

func (AvgOp[ResultT, InputT]) ConstantOperation

func (AvgOp[ResultT, InputT]) ConstantOperation(
	s3 *State[ResultT],
	input *InputT,
	data *AggrUnaryInput,
	count int,
	sop StateOp[ResultT],
	aop AddOp[ResultT, InputT],
	top TypeOp[ResultT])

func (AvgOp[ResultT, InputT]) Finalize

func (AvgOp[ResultT, InputT]) Finalize(
	s3 *State[ResultT],
	target *ResultT,
	data *AggrFinalizeData)

func (AvgOp[ResultT, InputT]) IgnoreNull

func (AvgOp[ResultT, InputT]) IgnoreNull() bool

func (AvgOp[ResultT, InputT]) Init

func (AvgOp[ResultT, InputT]) Init(
	s2 *State[ResultT],
	sop StateOp[ResultT])

func (AvgOp[ResultT, InputT]) Operation

func (AvgOp[ResultT, InputT]) Operation(
	s3 *State[ResultT],
	input *InputT,
	data *AggrUnaryInput,
	sop StateOp[ResultT],
	aop AddOp[ResultT, InputT],
	top TypeOp[ResultT])

type AvgStateOp

type AvgStateOp[T any] struct {
}

func (*AvgStateOp[T]) AddValues

func (as *AvgStateOp[T]) AddValues(s *State[T], cnt int)

func (*AvgStateOp[T]) Combine

func (as *AvgStateOp[T]) Combine(
	src *State[T],
	target *State[T],
	_ *AggrInputData,
	top TypeOp[T])

func (*AvgStateOp[T]) Init

func (as *AvgStateOp[T]) Init(s *State[T])

type BaseInfo

type BaseInfo struct {
	Database string // 数据库名
	Table    string // 表名
	Name     string // 列名
	Alias    string

	ColRef    ColumnBind   // 列引用(relationTag, columnPos)
	Depth     int          // 相关子查询深度(>0表示相关列)
	BelongCtx *BindContext // 所属的绑定上下文
}

列信息 - 用于列引用表达式

type BaseStats

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

func (BaseStats) Copy

func (bs BaseStats) Copy() *BaseStats

func (BaseStats) String

func (bs BaseStats) String() string

type BaseValueCopy

type BaseValueCopy[T any] interface {
	Assign(metaData *ColumnDataMetaData, dst, src unsafe.Pointer, dstIdx, srcIdx int)
	Operation(dst, src *T)
}

type BinaryFunc

type BinaryFunc[T any, S any, R any] func(left *T, right *S, result *R, mask *util.Bitmap, idx int)

type BinaryLambdaWrapper

type BinaryLambdaWrapper[T any, S any, R any] struct {
}

type BinaryLambdaWrapperWithNulls

type BinaryLambdaWrapperWithNulls[T any, S any, R any] struct {
}

type BinaryOp

type BinaryOp[T any, S any, R any] func(left *T, right *S, result *R)

type BinarySingleArgumentOperatorWrapper

type BinarySingleArgumentOperatorWrapper[T any, R any] struct {
	// contains filtered or unexported fields
}

type BinaryStandardOperatorWrapper

type BinaryStandardOperatorWrapper[T any, S any, R any] struct {
	// contains filtered or unexported fields
}

type BinaryWrapper

type BinaryWrapper[T any, S any, R any] interface {
	// contains filtered or unexported methods
}

type BindCastFunc

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

type BindCastFuncType

type BindCastFuncType func(input *BindCastInput, src, dst common.LType) *BoundCastInfo

type BindCastInfo

type BindCastInfo struct{}

type BindCastInput

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

type BindContext

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

func NewBindContext

func NewBindContext(parent *BindContext) *BindContext

func (*BindContext) AddBinding

func (bc *BindContext) AddBinding(alias string, b *Binding) error

func (*BindContext) AddContext

func (bc *BindContext) AddContext(obc *BindContext) error

func (*BindContext) BindColumn

func (bc *BindContext) BindColumn(table, column string, depth int) (*Expr, error)

func (*BindContext) Format

func (bc *BindContext) Format(ctx *FormatCtx)

func (*BindContext) GetBinding

func (bc *BindContext) GetBinding(name string) (*Binding, error)

func (*BindContext) GetCteBinding

func (bc *BindContext) GetCteBinding(name string) *Binding

func (*BindContext) GetMatchingBinding

func (bc *BindContext) GetMatchingBinding(table, column string) (*Binding, int, error)

func (*BindContext) Print

func (bc *BindContext) Print(tree treeprint.Tree)

func (*BindContext) RemoveContext

func (bc *BindContext) RemoveContext(obList []*Binding)

type Binding

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

func (*Binding) Bind

func (b *Binding) Bind(table, column string, depth int) (*Expr, error)

func (*Binding) Format

func (b *Binding) Format(ctx *FormatCtx)

func (*Binding) HasColumn

func (b *Binding) HasColumn(column string) int

func (*Binding) Print

func (b *Binding) Print(tree treeprint.Tree)

type BindingType

type BindingType int
const (
	BT_BASE BindingType = iota
	BT_TABLE
	BT_DUMMY
	BT_CATALOG_ENTRY
	BT_Subquery
)

func (BindingType) String

func (bt BindingType) String() string

type BlockAppendEntry

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

type BoolFunc

type BoolFunc struct {
}

func (BoolFunc) Register

func (BoolFunc) Register(funcList FunctionList)

type BooleanOp

type BooleanOp interface {
	// contains filtered or unexported methods
}

type BoundCastData

type BoundCastData struct {
}

BoundCastData generated during bind of cast, used during execution of cast

type BoundCastInfo

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

func BoolCastToSwitch

func BoolCastToSwitch(
	input *BindCastInput,
	src, dst common.LType,
) *BoundCastInfo

func DecimalCastToSwitch

func DecimalCastToSwitch(
	input *BindCastInput,
	src, dst common.LType,
) *BoundCastInfo

func DefaultCastFunc

func DefaultCastFunc(
	input *BindCastInput,
	src, dst common.LType) *BoundCastInfo

func FloatCastToSwitch

func FloatCastToSwitch(
	input *BindCastInput,
	src, dst common.LType,
) *BoundCastInfo

func HugeintCastToSwitch

func HugeintCastToSwitch(
	input *BindCastInput,
	src, dst common.LType,
) *BoundCastInfo

func IntegerCastToSwitch

func IntegerCastToSwitch(
	input *BindCastInput,
	src, dst common.LType,
) *BoundCastInfo

func NumericCastSwitch

func NumericCastSwitch(
	input *BindCastInput,
	src, dst common.LType,
) *BoundCastInfo

func StringCastToSwitch

func StringCastToSwitch(
	input *BindCastInput,
	src, dst common.LType,
) *BoundCastInfo

type Builder

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

func NewBuilder

func NewBuilder(txn *storage.Txn) *Builder

func (*Builder) CastLogicalOperatorToTypes

func (b *Builder) CastLogicalOperatorToTypes(
	targetTyps []common.LType,
	root *LogicalOperator) (*LogicalOperator, error)

func (*Builder) CreatePhyPlan

func (b *Builder) CreatePhyPlan(root *LogicalOperator) (*PhysicalOperator, error)

func (*Builder) CreatePlan

func (b *Builder) CreatePlan(ctx *BindContext, root *LogicalOperator) (*LogicalOperator, error)

func (*Builder) Format

func (b *Builder) Format(ctx *FormatCtx)

func (*Builder) GetTag

func (b *Builder) GetTag() int

func (*Builder) Optimize

func (b *Builder) Optimize(ctx *BindContext, root *LogicalOperator) (*LogicalOperator, error)

============== Optimize plan ==============

func (*Builder) Print

func (b *Builder) Print(tree treeprint.Tree)

func (*Builder) String

func (b *Builder) String() string

type CTEInfo

type CTEInfo struct {
	// CTE相关
	CTEIndex uint64 // CTE索引
}

CTE信息 - 用于CTE表达式

type CardinalityEstimator

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

func NewCardinalityEstimator

func NewCardinalityEstimator(txn *storage.Txn) *CardinalityEstimator

func (*CardinalityEstimator) AddColumnToRelationMap

func (est *CardinalityEstimator) AddColumnToRelationMap(tableIndex, columnIndex uint64)

func (*CardinalityEstimator) AddRelationColumnMapping

func (est *CardinalityEstimator) AddRelationColumnMapping(
	get *LogicalOperator,
	relId uint64) error

func (*CardinalityEstimator) AddRelationTdom

func (est *CardinalityEstimator) AddRelationTdom(filterInfo *FilterInfo)

func (*CardinalityEstimator) AddRelationToColumnMapping

func (est *CardinalityEstimator) AddRelationToColumnMapping(key, value ColumnBind)

func (*CardinalityEstimator) AddToEquivalenceSets

func (est *CardinalityEstimator) AddToEquivalenceSets(filterInfo *FilterInfo, set []uint64)

func (*CardinalityEstimator) CopyRelationMap

func (est *CardinalityEstimator) CopyRelationMap(cmap ColumnBindMap)

func (*CardinalityEstimator) DetermineMatchingEquivalentSets

func (est *CardinalityEstimator) DetermineMatchingEquivalentSets(filterInfo *FilterInfo) []uint64

func (*CardinalityEstimator) EmptyFilter

func (est *CardinalityEstimator) EmptyFilter(filterInfo *FilterInfo) bool

func (*CardinalityEstimator) EstimateBaseTableCard

func (est *CardinalityEstimator) EstimateBaseTableCard(node *JoinNode, op *LogicalOperator)

func (*CardinalityEstimator) EstimateCardWithSet

func (est *CardinalityEstimator) EstimateCardWithSet(newset *JoinRelationSet) float64

func (*CardinalityEstimator) EstimateCrossProduct

func (est *CardinalityEstimator) EstimateCrossProduct(left, right *JoinNode) float64

func (*CardinalityEstimator) GetTableFilters

func (est *CardinalityEstimator) GetTableFilters(op *LogicalOperator, tableIndex uint64) *TableFilterSet

func (*CardinalityEstimator) InitCardinalityEstimatorProps

func (est *CardinalityEstimator) InitCardinalityEstimatorProps(nodeOps []*NodeOp,
	filterInfos []*FilterInfo) error

func (*CardinalityEstimator) InitEquivalentRelations

func (est *CardinalityEstimator) InitEquivalentRelations(filterInfos []*FilterInfo)

func (*CardinalityEstimator) InitTotalDomains

func (est *CardinalityEstimator) InitTotalDomains()

func (*CardinalityEstimator) MergeBindings

func (est *CardinalityEstimator) MergeBindings(bindIdx uint64,
	relId uint64,
	cmaps []ColumnBindMap)

func (*CardinalityEstimator) SingleColumnFilter

func (est *CardinalityEstimator) SingleColumnFilter(filterInfo *FilterInfo) bool

func (*CardinalityEstimator) UpdateTotalDomains

func (est *CardinalityEstimator) UpdateTotalDomains(node *JoinNode, op *LogicalOperator) error

type CaseFunc

type CaseFunc struct {
}

func (CaseFunc) Register

func (CaseFunc) Register(funcList FunctionList)

type CastFuncType

type CastFuncType func(src, res *chunk.Vector, count int, params *CastParams) bool

func MakeCastFunc

func MakeCastFunc[T any, R any](op CastOp[T, R]) CastFuncType

type CastFunctionSet

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

func NewCastFunctionSet

func NewCastFunctionSet() *CastFunctionSet

func (*CastFunctionSet) GetCastFunc

func (castSet *CastFunctionSet) GetCastFunc(src, dst common.LType) *BoundCastInfo

func (*CastFunctionSet) ImplicitCastCost

func (castSet *CastFunctionSet) ImplicitCastCost(src, dst common.LType) int64

type CastOp

type CastOp[T any, R any] func(input *T, result *R, strict bool) bool

type CastParams

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

type Catalog

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

func (*Catalog) Table

func (c *Catalog) Table(db, table string) (*CatalogTable, error)

type CatalogTable

type CatalogTable struct {
	Db         string
	Table      string
	Columns    []string
	Types      []common.LType
	PK         []int
	Column2Idx map[string]int
	Stats      *Stats
}

type ColumnBind

type ColumnBind [2]uint64

func NewColumnBind

func NewColumnBind(a, b uint64) ColumnBind

func (ColumnBind) String

func (bind ColumnBind) String() string

type ColumnBindCountMap

type ColumnBindCountMap map[ColumnBind]int

type ColumnBindMap

type ColumnBindMap map[ColumnBind]ColumnBind

type ColumnBindPosMap

type ColumnBindPosMap map[ColumnBind]int

type ColumnBindSet

type ColumnBindSet map[ColumnBind]bool

type ColumnDataCollection

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

func NewColumnDataCollection

func NewColumnDataCollection(typs []common.LType) *ColumnDataCollection

func (*ColumnDataCollection) Append

func (cdc *ColumnDataCollection) Append(input *chunk.Chunk)

func (*ColumnDataCollection) Count

func (cdc *ColumnDataCollection) Count() int

func (*ColumnDataCollection) NextScanIndex

func (cdc *ColumnDataCollection) NextScanIndex(
	state *ColumnDataScanState,
	chunkIdx *int,
	rowIdx *int,
) bool

func (*ColumnDataCollection) ReadVector

func (cdc *ColumnDataCollection) ReadVector(
	state *ColumnDataScanState,
	srcVec *chunk.Vector,
	dstVec *chunk.Vector,
	count int,
) int

func (*ColumnDataCollection) Scan

func (cdc *ColumnDataCollection) Scan(
	state *ColumnDataScanState,
	output *chunk.Chunk) bool

type ColumnDataMetaData

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

type ColumnDataScanState

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

type ColumnPrune

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

func NewColumnPrune

func NewColumnPrune(txn *storage.Txn) *ColumnPrune

type CompareOp

type CompareOp[T any] interface {
	// contains filtered or unexported methods
}

type ConstType

type ConstType int

ConstType represents the type of a constant value

const (
	ConstTypeInvalid ConstType = iota
	ConstTypeInteger
	ConstTypeDecimal
	ConstTypeString
	ConstTypeFloat
	ConstTypeDate
	ConstTypeInterval
	ConstTypeBoolean
	ConstTypeNull
)

type ConstValue

type ConstValue struct {
	Type ConstType

	// 每种类型一个具体字段
	Integer  int64
	Decimal  string
	String   string
	Float    float64
	Date     string
	Interval struct {
		Value int64
		Unit  string
	}
	Boolean bool
}

ConstValue represents a constant value with its type and actual value

func NewBooleanConst

func NewBooleanConst(value bool) ConstValue

NewBooleanConst creates a new boolean constant

func NewDateConst

func NewDateConst(value string) ConstValue

NewDateConst creates a new date constant

func NewDecimalConst

func NewDecimalConst(value string) ConstValue

NewDecimalConst creates a new decimal constant

func NewFloatConst

func NewFloatConst(value float64) ConstValue

NewFloatConst creates a new float constant

func NewIntegerConst

func NewIntegerConst(value int64) ConstValue

NewIntegerConst creates a new integer constant

func NewIntervalConst

func NewIntervalConst(value int64, unit string) ConstValue

NewIntervalConst creates a new interval constant

func NewNullConst

func NewNullConst() ConstValue

NewNullConst creates a new null constant

func NewStringConst

func NewStringConst(value string) ConstValue

NewStringConst creates a new string constant

func (ConstValue) GetBoolean

func (c ConstValue) GetBoolean() (bool, error)

GetBoolean returns the boolean value of the constant

func (ConstValue) GetDate

func (c ConstValue) GetDate() (string, error)

GetDate returns the date value of the constant

func (ConstValue) GetDecimal

func (c ConstValue) GetDecimal() (string, error)

GetDecimal returns the decimal value of the constant

func (ConstValue) GetFloat

func (c ConstValue) GetFloat() (float64, error)

GetFloat returns the float value of the constant

func (ConstValue) GetInteger

func (c ConstValue) GetInteger() (int64, error)

GetInteger returns the integer value of the constant

func (ConstValue) GetInterval

func (c ConstValue) GetInterval() (int64, string, error)

GetInterval returns the interval value and unit of the constant

func (ConstValue) GetString

func (c ConstValue) GetString() (string, error)

GetString returns the string value of the constant

func (ConstValue) IsNull

func (c ConstValue) IsNull() bool

IsNull returns whether the constant is null

type CountFunc

type CountFunc struct {
}

func (CountFunc) Register

func (CountFunc) Register(funcList FunctionList)

type CountOp

type CountOp[ResultT any, InputT any] struct {
}

func (CountOp[ResultT, InputT]) Combine

func (CountOp[ResultT, InputT]) Combine(
	src *State[ResultT],
	target *State[ResultT],
	data *AggrInputData,
	sop StateOp[ResultT],
	top TypeOp[ResultT])

func (CountOp[ResultT, InputT]) ConstantOperation

func (CountOp[ResultT, InputT]) ConstantOperation(
	s3 *State[ResultT],
	input *InputT,
	data *AggrUnaryInput,
	count int,
	sop StateOp[ResultT],
	aop AddOp[ResultT, InputT],
	top TypeOp[ResultT])

func (CountOp[ResultT, InputT]) Finalize

func (CountOp[ResultT, InputT]) Finalize(
	s3 *State[ResultT],
	target *ResultT,
	data *AggrFinalizeData)

func (CountOp[ResultT, InputT]) IgnoreNull

func (CountOp[ResultT, InputT]) IgnoreNull() bool

func (CountOp[ResultT, InputT]) Init

func (CountOp[ResultT, InputT]) Init(
	s2 *State[ResultT],
	sop StateOp[ResultT])

func (CountOp[ResultT, InputT]) Operation

func (CountOp[ResultT, InputT]) Operation(
	s3 *State[ResultT],
	input *InputT,
	data *AggrUnaryInput,
	sop StateOp[ResultT],
	aop AddOp[ResultT, InputT],
	top TypeOp[ResultT])

type CountStateOp

type CountStateOp[T any] struct {
}

func (*CountStateOp[T]) AddValues

func (as *CountStateOp[T]) AddValues(s *State[T], cnt int)

func (*CountStateOp[T]) Combine

func (as *CountStateOp[T]) Combine(
	src *State[T],
	target *State[T],
	_ *AggrInputData,
	top TypeOp[T])

func (*CountStateOp[T]) Init

func (as *CountStateOp[T]) Init(s *State[T])

type CrossProduct

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

func NewCrossProduct

func NewCrossProduct(types []common.LType) *CrossProduct

func (*CrossProduct) Execute

func (cross *CrossProduct) Execute(input, output *chunk.Chunk) (OperatorResult, error)

func (*CrossProduct) Sink

func (cross *CrossProduct) Sink(input *chunk.Chunk)

type CrossProductExec

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

func NewCrossProductExec

func NewCrossProductExec(rhs *ColumnDataCollection) *CrossProductExec

func (*CrossProductExec) Execute

func (cross *CrossProductExec) Execute(input, output *chunk.Chunk) (OperatorResult, error)

func (*CrossProductExec) NextValue

func (cross *CrossProductExec) NextValue(input, output *chunk.Chunk) bool

func (*CrossProductExec) Reset

func (cross *CrossProductExec) Reset()

type CrossStage

type CrossStage int
const (
	CROSS_INIT CrossStage = iota
	CROSS_BUILD
	CROSS_PROBE
)

type DataType

type DataType int
const (
	DataTypeInteger DataType = iota
	DataTypeVarchar
	DataTypeDecimal
	DataTypeDate
	DataTypeBool
	DataTypeInterval
	DataTypeFloat64
	DataTypeInvalid // used in binding process
)

func (DataType) String

func (dt DataType) String() string

type DateAdd

type DateAdd struct {
}

func (DateAdd) Register

func (DateAdd) Register(funcList FunctionList)

type DateSub

type DateSub struct {
}

func (DateSub) Register

func (DateSub) Register(funcList FunctionList)

type DecimalAdd

type DecimalAdd struct {
}

func (*DecimalAdd) AddConstant

func (*DecimalAdd) AddNumber

func (dAdd *DecimalAdd) AddNumber(state *State[common.Decimal], input *common.Decimal, top TypeOp[common.Decimal])

func (*DecimalAdd) Assign

func (*DecimalAdd) Assign(s *State[common.Decimal], input *common.Decimal)

func (*DecimalAdd) Execute

func (*DecimalAdd) Execute(s *State[common.Decimal], input *common.Decimal, top TypeOp[common.Decimal])

type DevideFunc

type DevideFunc struct {
}

func (DevideFunc) Register

func (DevideFunc) Register(funcList FunctionList)

type DistinctAggrCollectionInfo

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

func CreateDistinctAggrCollectionInfo

func CreateDistinctAggrCollectionInfo(aggregates []*Expr) *DistinctAggrCollectionInfo

func NewDistinctAggrCollectionInfo

func NewDistinctAggrCollectionInfo(
	aggregates []*Expr,
	indices []int,
) *DistinctAggrCollectionInfo

func (*DistinctAggrCollectionInfo) CreateTableIndexMap

func (daci *DistinctAggrCollectionInfo) CreateTableIndexMap() int

type DistinctAggrData

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

func NewDistinctAggrData

func NewDistinctAggrData(
	info *DistinctAggrCollectionInfo,
	groups GroupingSet,
	groupExprs []*Expr,
	rawInputTypes []common.LType,
) *DistinctAggrData

func (*DistinctAggrData) IsDistinct

func (dad *DistinctAggrData) IsDistinct(index int) bool

type Double

type Double float64

func (Double) Add

func (Double) Add(lhs, rhs *float64)

func (Double) Greater

func (Double) Greater(lhs, rhs *float64) bool

func (Double) Less

func (Double) Less(lhs, rhs *float64) bool

func (Double) Mul

func (Double) Mul(lhs, rhs *float64)

type DoubleAdd

type DoubleAdd struct{}

func (DoubleAdd) AddConstant

func (DoubleAdd) AddConstant(
	*State[float64],
	*float64,
	int,
	TypeOp[float64])

func (DoubleAdd) AddNumber

func (DoubleAdd) AddNumber(
	state *State[float64],
	input *float64,
	top TypeOp[float64])

func (*DoubleAdd) Assign

func (*DoubleAdd) Assign(*State[float64], *float64)

func (*DoubleAdd) Execute

func (*DoubleAdd) Execute(*State[float64], *float64, TypeOp[float64])

type DoubleInt32Add

type DoubleInt32Add struct{}

func (DoubleInt32Add) AddConstant

func (DoubleInt32Add) AddConstant(
	*State[float64],
	*int32,
	int,
	TypeOp[float64])

func (DoubleInt32Add) AddNumber

func (DoubleInt32Add) AddNumber(
	state *State[float64],
	input *int32,
	top TypeOp[float64])

func (*DoubleInt32Add) Assign

func (*DoubleInt32Add) Assign(*State[float64], *int32)

func (*DoubleInt32Add) Execute

func (*DoubleInt32Add) Execute(*State[float64], *int32, TypeOp[float64])

type ET

type ET int
const (
	ET_Column     ET = iota //column
	ET_TABLE                //table
	ET_ValuesList           //for insert
	ET_Join                 //join
	ET_CTE

	ET_Func
	ET_Subquery

	ET_Const // 新增统一的常量类型

	ET_Orderby
	ET_List
)

type ET_JoinType

type ET_JoinType int
const (
	ET_JoinTypeCross ET_JoinType = iota
	ET_JoinTypeLeft
	ET_JoinTypeInner
)

type ET_SubqueryType

type ET_SubqueryType int
const (
	ET_SubqueryTypeScalar ET_SubqueryType = iota
	ET_SubqueryTypeExists
	ET_SubqueryTypeNotExists
	ET_SubqueryTypeIn
	ET_SubqueryTypeNotIn
)

type Encoder

type Encoder[T any] interface {
	EncodeData(unsafe.Pointer, *T)
	TypeSize() int
}

type Equal

type Equal interface {
	Equal(key Equal) bool
}

type EqualFunc

type EqualFunc struct {
}

func (EqualFunc) Register

func (equal EqualFunc) Register(funcList FunctionList)

type EstimatedProperties

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

func NewEstimatedProperties

func NewEstimatedProperties(card, cost float64) *EstimatedProperties

func (EstimatedProperties) Copy

type ExecStats

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

func (ExecStats) String

func (stats ExecStats) String() string

type ExplainBuffer

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

func NewExplainBuffer

func NewExplainBuffer() *ExplainBuffer

func (*ExplainBuffer) AppendLine

func (eb *ExplainBuffer) AppendLine(line string, level int, newNode bool)

func (*ExplainBuffer) AppendTitle

func (eb *ExplainBuffer) AppendTitle(title string)

func (*ExplainBuffer) String

func (eb *ExplainBuffer) String() string

type ExplainCtx

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

type ExplainOption

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

type ExplainOptions

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

func NewExplainOptions

func NewExplainOptions() *ExplainOptions

func (*ExplainOptions) SetBooleanOption

func (eopt *ExplainOptions) SetBooleanOption(option int, enabled bool)

func (*ExplainOptions) SetDefaultValues

func (eopt *ExplainOptions) SetDefaultValues()

func (*ExplainOptions) SetFormatOption

func (eopt *ExplainOptions) SetFormatOption(option int, format int)

func (*ExplainOptions) SetSerializeOption

func (eopt *ExplainOptions) SetSerializeOption(option int, serialize int)

func (*ExplainOptions) String

func (eopt *ExplainOptions) String() string

type ExplainPosition

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

type Expr

type Expr struct {
	BaseInfo
	FunctionInfo
	SubqueryInfo
	JoinInfo
	TableInfo
	ValuesListInfo
	ConstValue ConstValue // 常量值
	OrderByInfo
	CTEInfo

	Typ      ET
	DataTyp  common.LType
	Index    uint64
	Children []*Expr
}

func AddCastToType

func AddCastToType(expr *Expr, dstTyp common.LType, tryCast bool) (*Expr, error)

func (*Expr) IsNull

func (e *Expr) IsNull() bool

func (*Expr) String

func (e *Expr) String() string

type ExprExec

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

func NewExprExec

func NewExprExec(es ...*Expr) *ExprExec

type ExprExecState

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

type ExprState

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

func NewExprState

func NewExprState(expr *Expr, eeState *ExprExecState) *ExprState

type ExtractFunc

type ExtractFunc struct {
}

func (ExtractFunc) Register

func (ExtractFunc) Register(funcList FunctionList)

type FilterInfo

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

type Format

type Format interface {
	Format(*FormatCtx)
}

type FormatCtx

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

func (*FormatCtx) AddOffset

func (fc *FormatCtx) AddOffset()

func (*FormatCtx) RestoreOffset

func (fc *FormatCtx) RestoreOffset()

func (*FormatCtx) String

func (fc *FormatCtx) String() string

func (*FormatCtx) Write

func (fc *FormatCtx) Write(s string)

func (*FormatCtx) WriteStrings

func (fc *FormatCtx) WriteStrings(ss []string)

func (*FormatCtx) Writef

func (fc *FormatCtx) Writef(f string, args ...any)

func (*FormatCtx) Writefln

func (fc *FormatCtx) Writefln(f string, args ...any)

func (*FormatCtx) Writeln

func (fc *FormatCtx) Writeln(args ...any)

type FuncNullHandling

type FuncNullHandling int
const (
	DefaultNullHandling FuncNullHandling = 0
	SpecialHandling     FuncNullHandling = 1
)

type FuncSideEffects

type FuncSideEffects int
const (
	NoSideEffects  FuncSideEffects = 0
	HasSideEffects FuncSideEffects = 1
)

type FuncType

type FuncType int
const (
	ScalarFuncType    FuncType = 0
	AggregateFuncType FuncType = 1
	TableFuncType     FuncType = 2
)

type Function

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

func GetAvgAggr

func GetAvgAggr(retPhyTyp common.PhyType, inputPhyTyp common.PhyType) *Function

func GetCountAggr

func GetCountAggr(retPhyTyp common.PhyType, inputPhyTyp common.PhyType) *Function

func GetMaxAggr

func GetMaxAggr(retPhyTyp common.PhyType, inputPhyTyp common.PhyType) *Function

func GetMinAggr

func GetMinAggr(retPhyTyp common.PhyType, inputPhyTyp common.PhyType) *Function

func GetSumAggr

func GetSumAggr(pTyp common.PhyType) *Function

func UnaryAggregate

func UnaryAggregate[ResultT any, STATE State[ResultT], InputT any, OP AggrOp[ResultT, InputT]](
	inputTyp common.LType,
	retTyp common.LType,
	nullHandling FuncNullHandling,
	aop AggrOp[ResultT, InputT],
	sop StateOp[ResultT],
	addOp AddOp[ResultT, InputT],
	top TypeOp[ResultT],
) *Function

func (*Function) Copy

func (fun *Function) Copy() *Function

func (*Function) IsFunction

func (fun *Function) IsFunction() bool

func (*Function) IsOperator

func (fun *Function) IsOperator() bool

type FunctionBinder

type FunctionBinder struct {
}

func (*FunctionBinder) BindAggrFunc

func (binder *FunctionBinder) BindAggrFunc(
	name string,
	args []*Expr,
	isOperator bool,
) *Expr

func (*FunctionBinder) BindAggrFunc2

func (binder *FunctionBinder) BindAggrFunc2(
	fun *Function,
	args []*Expr,
	isOperator bool,
) *Expr

func (*FunctionBinder) BindFunc

func (binder *FunctionBinder) BindFunc(
	name string,
	set *FunctionSet,
	args []common.LType,
) int

func (*FunctionBinder) BindFunc2

func (binder *FunctionBinder) BindFunc2(
	name string,
	set *FunctionSet,
	args []*Expr,
) int

func (*FunctionBinder) BindFuncByArgs

func (binder *FunctionBinder) BindFuncByArgs(
	name string,
	set *FunctionSet,
	args []common.LType,
) int

func (*FunctionBinder) BindFuncByArgs2

func (binder *FunctionBinder) BindFuncByArgs2(
	name string,
	set *FunctionSet,
	args []common.LType,
) []int

func (*FunctionBinder) BindFuncCost

func (binder *FunctionBinder) BindFuncCost(
	fun *Function,
	args []common.LType,
) int64

func (*FunctionBinder) BindScalarFunc

func (binder *FunctionBinder) BindScalarFunc(
	name string,
	args []*Expr,
	isOperator bool,
) *Expr

func (*FunctionBinder) BindScalarFunc2

func (binder *FunctionBinder) BindScalarFunc2(
	fun *Function,
	args []*Expr,
	isOperator bool,
) *Expr

func (*FunctionBinder) CastToFuncArgs

func (binder *FunctionBinder) CastToFuncArgs(fun *Function, args []*Expr)

type FunctionData

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

func BindDecimalAddSubstract

func BindDecimalAddSubstract(fun *Function, args []*Expr) *FunctionData

func BindDecimalAvg

func BindDecimalAvg(fun *Function, args []*Expr) *FunctionData

func BindDecimalCaseWhen

func BindDecimalCaseWhen(fun *Function, args []*Expr) *FunctionData

func BindDecimalDivide

func BindDecimalDivide(fun *Function, args []*Expr) *FunctionData

func BindDecimalMinMax

func BindDecimalMinMax(fun *Function, args []*Expr) *FunctionData

func BindDecimalMultiply

func BindDecimalMultiply(fun *Function, args []*Expr) *FunctionData

func BindDecimalSum

func BindDecimalSum(fun *Function, args []*Expr) *FunctionData

func DecimalNegateBind

func DecimalNegateBind(fun *Function, args []*Expr) *FunctionData

func NopDecimalBind

func NopDecimalBind(fun *Function, args []*Expr) *FunctionData

type FunctionInfo

type FunctionInfo struct {
	FunImpl  *Function     // 函数实现
	BindInfo *FunctionData // 函数绑定信息
}

函数信息 - 用于函数和运算符表达式

type FunctionList

type FunctionList map[string]*FunctionSet

func (FunctionList) Add

func (flist FunctionList) Add(name string, set *FunctionSet)

type FunctionSet

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

func NewFunctionSet

func NewFunctionSet(name string, ftyp FuncType) *FunctionSet

func (*FunctionSet) Add

func (set *FunctionSet) Add(fun *Function)

func (*FunctionSet) GetFunc

func (set *FunctionSet) GetFunc(offset int) *Function

func (*FunctionSet) GetFuncByArgs

func (set *FunctionSet) GetFuncByArgs(args []common.LType) *Function

type GenerateJoinRelation

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

type GenericUnaryWrapper

type GenericUnaryWrapper[T any, R any] struct {
	// contains filtered or unexported fields
}

type Greater

type Greater struct {
}

func (Greater) Register

func (Greater) Register(funcList FunctionList)

type GreaterThan

type GreaterThan struct {
}

func (GreaterThan) Register

func (GreaterThan) Register(funcList FunctionList)

type GroupedAggrData

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

func (*GroupedAggrData) GroupCount

func (gad *GroupedAggrData) GroupCount() int

func (*GroupedAggrData) InitChildrenOutput

func (gad *GroupedAggrData) InitChildrenOutput(outputs []*Expr)

func (*GroupedAggrData) InitDistinct

func (gad *GroupedAggrData) InitDistinct(
	aggr *Expr,
	groups []*Expr,
	rawInputTypes []common.LType,
)

func (*GroupedAggrData) InitDistinctGroups

func (gad *GroupedAggrData) InitDistinctGroups(
	groups []*Expr,
)

func (*GroupedAggrData) InitGroupby

func (gad *GroupedAggrData) InitGroupby(
	groups []*Expr,
	exprs []*Expr,
	groupingFuncs [][]int,
	refChildrenOutput []*Expr,
)

func (*GroupedAggrData) InitGroupbyGroups

func (gad *GroupedAggrData) InitGroupbyGroups(groups []*Expr)

func (*GroupedAggrData) SetGroupingFuncs

func (gad *GroupedAggrData) SetGroupingFuncs(funcs [][]int)

type GroupedAggrHashTable

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

func NewGroupedAggrHashTable

func NewGroupedAggrHashTable(
	groupTypes []common.LType,
	payloadTypes []common.LType,
	childrenOutputTypes []common.LType,
	aggrObjs []*AggrObject,
	initCap int,
	bufMgr *storage.BufferManager,
) *GroupedAggrHashTable

func (*GroupedAggrHashTable) AddChunk

func (aht *GroupedAggrHashTable) AddChunk(
	state *AggrHTAppendState,
	groups *chunk.Chunk,
	groupHashes *chunk.Vector,
	payload *chunk.Chunk,
	childrenOutput *chunk.Chunk,
	filter []int,
) int

func (*GroupedAggrHashTable) AddChunk2

func (aht *GroupedAggrHashTable) AddChunk2(
	state *AggrHTAppendState,
	groups *chunk.Chunk,
	payload *chunk.Chunk,
	childrenOutput *chunk.Chunk,
	filter []int,
) int

func (*GroupedAggrHashTable) Count

func (aht *GroupedAggrHashTable) Count() int

func (*GroupedAggrHashTable) FetchAggregates

func (aht *GroupedAggrHashTable) FetchAggregates(groups, result *chunk.Chunk)

func (*GroupedAggrHashTable) Finalize

func (aht *GroupedAggrHashTable) Finalize()

func (*GroupedAggrHashTable) FindOrCreateGroups

func (aht *GroupedAggrHashTable) FindOrCreateGroups(
	state *AggrHTAppendState,
	groups *chunk.Chunk,
	groupHashes *chunk.Vector,
	addresses *chunk.Vector,
	newGroupsOut *chunk.SelectVector,
	childrenOutput *chunk.Chunk,
) int

func (*GroupedAggrHashTable) Resize

func (aht *GroupedAggrHashTable) Resize(size int)

func (*GroupedAggrHashTable) ResizeThreshold

func (aht *GroupedAggrHashTable) ResizeThreshold() int

func (*GroupedAggrHashTable) Scan

func (aht *GroupedAggrHashTable) Scan(state *TupleDataScanState, result *chunk.Chunk) int

func (*GroupedAggrHashTable) UpdateBlockPointers

func (aht *GroupedAggrHashTable) UpdateBlockPointers()

func (*GroupedAggrHashTable) Verify

func (aht *GroupedAggrHashTable) Verify()

type GroupingSet

type GroupingSet map[int]struct{}

type HashAggr

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

func NewHashAggr

func NewHashAggr(
	types []common.LType,
	aggrExprs []*Expr,
	groups []*Expr,
	groupingSets []GroupingSet,
	groupingFuncs [][]int,
	refChildrenOutput []*Expr,
) *HashAggr

func (*HashAggr) DistinctGrouping

func (haggr *HashAggr) DistinctGrouping(
	groupingData *HashAggrGroupingData,
	groupingIdx int,
)

func (*HashAggr) FetechAggregates

func (haggr *HashAggr) FetechAggregates(state *HashAggrScanState, groups, output *chunk.Chunk) OperatorResult

func (*HashAggr) Finalize

func (haggr *HashAggr) Finalize()

func (*HashAggr) FinalizeDistinct

func (haggr *HashAggr) FinalizeDistinct()

func (*HashAggr) FinalizeInternal

func (haggr *HashAggr) FinalizeInternal(checkDistinct bool)

func (*HashAggr) GetData

func (haggr *HashAggr) GetData(state *HashAggrScanState, output, rawInput *chunk.Chunk) OperatorResult

func (*HashAggr) Sink

func (haggr *HashAggr) Sink(data *chunk.Chunk)

func (*HashAggr) SinkDistinct

func (haggr *HashAggr) SinkDistinct(chunk, childrenOutput *chunk.Chunk)

func (*HashAggr) SinkDistinctGrouping

func (haggr *HashAggr) SinkDistinctGrouping(
	data, childrenOutput *chunk.Chunk,
	groupingIdx int,
)

type HashAggrGroupingData

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

func NewHashAggrGroupingData

func NewHashAggrGroupingData(
	groupingSet GroupingSet,
	aggrData *GroupedAggrData,
	info *DistinctAggrCollectionInfo,
) *HashAggrGroupingData

type HashAggrScanState

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

func NewHashAggrScanState

func NewHashAggrScanState() *HashAggrScanState

type HashAggrState

type HashAggrState int
const (
	HAS_INIT HashAggrState = iota
	HAS_BUILD
	HAS_SCAN
)

type HashJoin

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

func NewHashJoin

func NewHashJoin(op *PhysicalOperator, conds []*Expr) *HashJoin

func (*HashJoin) Build

func (hj *HashJoin) Build(input *chunk.Chunk) error

type HashJoinStage

type HashJoinStage int
const (
	HJS_INIT HashJoinStage = iota
	HJS_BUILD
	HJS_PROBE
	HJS_SCAN_HT
	HJS_DONE
)

type HugeintAdd

type HugeintAdd struct {
}

func (*HugeintAdd) AddConstant

func (*HugeintAdd) AddConstant(*State[common.Hugeint], *int32, int, TypeOp[common.Hugeint])

func (*HugeintAdd) AddNumber

func (hadd *HugeintAdd) AddNumber(state *State[common.Hugeint], input *int32, top TypeOp[common.Hugeint])

func (*HugeintAdd) Assign

func (*HugeintAdd) Assign(*State[common.Hugeint], *int32)

func (*HugeintAdd) Execute

type HugeintAddInt64

type HugeintAddInt64 struct {
}

func (*HugeintAddInt64) AddConstant

func (*HugeintAddInt64) AddNumber

func (hadd *HugeintAddInt64) AddNumber(state *State[common.Hugeint], input *int64, top TypeOp[common.Hugeint])

func (*HugeintAddInt64) Assign

func (*HugeintAddInt64) Assign(*State[common.Hugeint], *int64)

func (*HugeintAddInt64) Execute

type InFunc

type InFunc struct {
}

func (InFunc) Register

func (in InFunc) Register(funcList FunctionList)

type InWhichClause

type InWhichClause int
const (
	IWC_SELECT InWhichClause = iota
	IWC_WHERE
	IWC_GROUP
	IWC_HAVING
	IWC_ORDER
	IWC_LIMIT
	IWC_JOINON
	IWC_VALUES //for insert ... values
)

type IntSet

type IntSet map[int]struct{}

type JoinHashTable

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

func NewJoinHashTable

func NewJoinHashTable(conds []*Expr,
	buildTypes []common.LType,
	joinTyp LOT_JoinType) *JoinHashTable

func (*JoinHashTable) ApplyBitmask

func (jht *JoinHashTable) ApplyBitmask(hashes *chunk.Vector, cnt int)

func (*JoinHashTable) ApplyBitmask2

func (jht *JoinHashTable) ApplyBitmask2(
	hashes *chunk.Vector,
	sel *chunk.SelectVector,
	cnt int,
	pointers *chunk.Vector,
)

func (*JoinHashTable) Build

func (jht *JoinHashTable) Build(keys *chunk.Chunk, payload *chunk.Chunk)

func (*JoinHashTable) Finalize

func (jht *JoinHashTable) Finalize()

func (*JoinHashTable) InitPointerTable

func (jht *JoinHashTable) InitPointerTable()

func (*JoinHashTable) InsertHashes

func (jht *JoinHashTable) InsertHashes(hashes *chunk.Vector, cnt int, keyLocs []unsafe.Pointer)

func (*JoinHashTable) Probe

func (jht *JoinHashTable) Probe(keys *chunk.Chunk) *Scan

type JoinInfo

type JoinInfo struct {
	// 连接相关
	JoinTyp ET_JoinType // 连接类型(交叉/左连接/内连接)
	On      *Expr       // 连接条件
}

连接信息 - 用于连接表达式

type JoinNode

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

func NewJoinNode

func NewJoinNode(set *JoinRelationSet, baseCard float64) *JoinNode

type JoinOrderOptimizer

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

func NewJoinOrderOptimizer

func NewJoinOrderOptimizer(txn *storage.Txn) *JoinOrderOptimizer

func (*JoinOrderOptimizer) ComputeCost

func (joinOrder *JoinOrderOptimizer) ComputeCost(left, right *JoinNode, expectedCard float64) float64

func (*JoinOrderOptimizer) Optimize

func (joinOrder *JoinOrderOptimizer) Optimize(root *LogicalOperator) (*LogicalOperator, error)

type JoinRelationSet

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

func NewJoinRelationSet

func NewJoinRelationSet(rels []uint64) *JoinRelationSet

func (*JoinRelationSet) Equal

func (irs *JoinRelationSet) Equal(o Equal) bool

func (*JoinRelationSet) String

func (irs *JoinRelationSet) String() string

type JoinRelationSetManager

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

func NewJoinRelationSetManager

func NewJoinRelationSetManager() *JoinRelationSetManager

func (*JoinRelationSetManager) String

func (jrsm *JoinRelationSetManager) String() string

type LOT

type LOT int
const (
	LOT_Project      LOT = 0
	LOT_Filter       LOT = 1
	LOT_Scan         LOT = 2
	LOT_JOIN         LOT = 3
	LOT_AggGroup     LOT = 4
	LOT_Order        LOT = 5
	LOT_Limit        LOT = 6
	LOT_CreateSchema LOT = 7
	LOT_CreateTable  LOT = 8
	LOT_Insert       LOT = 9
)

func (LOT) String

func (lt LOT) String() string

type LOT_JoinType

type LOT_JoinType int
const (
	LOT_JoinTypeCross LOT_JoinType = iota
	LOT_JoinTypeLeft
	LOT_JoinTypeInner
	LOT_JoinTypeSEMI
	LOT_JoinTypeANTI
	LOT_JoinTypeSINGLE
	LOT_JoinTypeMARK
	LOT_JoinTypeAntiMARK
	LOT_JoinTypeOUTER
)

func (LOT_JoinType) String

func (lojt LOT_JoinType) String() string

type LTypeCmpResult

type LTypeCmpResult int
const (
	IDENTICAL_TYPE  LTypeCmpResult = 0
	TARGET_IS_ANY   LTypeCmpResult = 1
	DIFFERENT_TYPES LTypeCmpResult = 2
)

func RequireCast

func RequireCast(src, dst common.LType) LTypeCmpResult

type LessEqualFunc

type LessEqualFunc struct {
}

func (LessEqualFunc) Register

func (LessEqualFunc) Register(funcList FunctionList)

type LessFunc

type LessFunc struct {
}

func (LessFunc) Register

func (LessFunc) Register(funcList FunctionList)

type LikeFunc

type LikeFunc struct {
}

func (LikeFunc) Register

func (like LikeFunc) Register(funcList FunctionList)

type Limit

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

func NewLimit

func NewLimit(typs []common.LType, limitExpr, offsetExpr *Expr) *Limit

func (*Limit) ComputeOffset

func (limit *Limit) ComputeOffset(
	chunk *chunk.Chunk,
	maxElement *uint64) bool

func (*Limit) GetData

func (limit *Limit) GetData(read *chunk.Chunk) SourceResult

func (*Limit) HandleOffset

func (limit *Limit) HandleOffset(
	input *chunk.Chunk,
	currentOffset *uint64,
) bool

func (*Limit) Sink

func (limit *Limit) Sink(chunk *chunk.Chunk) SinkResult

type LimitReader

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

type LimitState

type LimitState int
const (
	LIMIT_INIT LimitState = iota
	LIMIT_SCAN
)

type LocalSort

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

func NewLocalSort

func NewLocalSort(slayout *SortLayout, playout *RowLayout) *LocalSort

func (*LocalSort) ConcatenateBlocks

func (ls *LocalSort) ConcatenateBlocks(rowData *RowDataCollection) *RowDataBlock

func (*LocalSort) ReOrder

func (ls *LocalSort) ReOrder(reorderHeap bool)

func (*LocalSort) ReOrder2

func (ls *LocalSort) ReOrder2(
	sd *SortedData,
	sortingPtr unsafe.Pointer,
	heap *RowDataCollection,
	reorderHeap bool,
)

func (*LocalSort) SinkChunk

func (ls *LocalSort) SinkChunk(sort, payload *chunk.Chunk)

func (*LocalSort) Sort

func (ls *LocalSort) Sort(reorderHeap bool)

func (*LocalSort) SortInMemory

func (ls *LocalSort) SortInMemory()

type LogicalOperator

type LogicalOperator struct {
	Typ       LOT
	Children  []*LogicalOperator
	Projects  []*Expr
	Index     uint64 //AggNode for groupTag. others in other Nodes
	Index2    uint64 //AggNode for aggTag
	Database  string
	Table     string       // table
	Alias     string       // alias
	Columns   []string     //needed column name for SCAN
	Filters   []*Expr      //for FILTER or AGG
	BelongCtx *BindContext //for table or join
	JoinTyp   LOT_JoinType
	OnConds   []*Expr //for innor join
	Aggs      []*Expr
	GroupBys  []*Expr
	OrderBys  []*Expr
	Limit     *Expr
	Offset    *Expr
	Stats     *Stats

	Outputs        []*Expr
	IfNotExists    bool
	ColDefs        []*storage.ColumnDefinition //for create table
	Constraints    []*storage.Constraint       //for create table
	TableEnt       *storage.CatalogEntry       //for insert
	TableIndex     int                         //for insert
	ExpectedTypes  []common.LType              //for insert
	IsValuesList   bool                        //for insert ... values
	ScanTyp        ScanType
	Types          []common.LType //for insert ... values
	Names          []string       //for insert ... values
	Values         [][]*Expr      //for insert ... values
	ColName2Idx    map[string]int
	ColumnIndexMap []int //for insert
	ScanInfo       *ScanInfo
	Counts         ColumnBindCountMap `json:"-"`
	ColRefToPos    ColumnBindPosMap   `json:"-"`
	// contains filtered or unexported fields
}

func (*LogicalOperator) EstimatedCard

func (lo *LogicalOperator) EstimatedCard(txn *storage.Txn) uint64

func (*LogicalOperator) String

func (lo *LogicalOperator) String() string

type MaxFunc

type MaxFunc struct {
}

func (MaxFunc) Register

func (MaxFunc) Register(funcList FunctionList)

type MaxStateOp

type MaxStateOp[T any] struct {
}

func (*MaxStateOp[T]) AddValues

func (as *MaxStateOp[T]) AddValues(s *State[T], cnt int)

func (*MaxStateOp[T]) Combine

func (as *MaxStateOp[T]) Combine(
	src *State[T],
	target *State[T],
	_ *AggrInputData,
	top TypeOp[T])

func (*MaxStateOp[T]) Init

func (as *MaxStateOp[T]) Init(s *State[T])

type MinFunc

type MinFunc struct {
}

func (MinFunc) Register

func (MinFunc) Register(funcList FunctionList)

type MinMaxOp

type MinMaxOp[ResultT any, InputT any] struct {
}

func (MinMaxOp[ResultT, InputT]) Combine

func (MinMaxOp[ResultT, InputT]) Combine(
	src *State[ResultT],
	target *State[ResultT],
	data *AggrInputData,
	sop StateOp[ResultT],
	top TypeOp[ResultT])

func (MinMaxOp[ResultT, InputT]) ConstantOperation

func (MinMaxOp[ResultT, InputT]) ConstantOperation(
	s3 *State[ResultT],
	input *InputT,
	data *AggrUnaryInput,
	count int,
	sop StateOp[ResultT],
	aop AddOp[ResultT, InputT],
	top TypeOp[ResultT])

func (MinMaxOp[ResultT, InputT]) Finalize

func (MinMaxOp[ResultT, InputT]) Finalize(
	s3 *State[ResultT],
	target *ResultT,
	data *AggrFinalizeData)

func (MinMaxOp[ResultT, InputT]) IgnoreNull

func (MinMaxOp[ResultT, InputT]) IgnoreNull() bool

func (MinMaxOp[ResultT, InputT]) Init

func (MinMaxOp[ResultT, InputT]) Init(
	s2 *State[ResultT],
	sop StateOp[ResultT])

func (MinMaxOp[ResultT, InputT]) Operation

func (MinMaxOp[ResultT, InputT]) Operation(
	s3 *State[ResultT],
	input *InputT,
	data *AggrUnaryInput,
	sop StateOp[ResultT],
	aop AddOp[ResultT, InputT],
	top TypeOp[ResultT])

type MinStateOp

type MinStateOp[T any] struct {
}

func (*MinStateOp[T]) AddValues

func (as *MinStateOp[T]) AddValues(s *State[T], cnt int)

func (*MinStateOp[T]) Combine

func (as *MinStateOp[T]) Combine(
	src *State[T],
	target *State[T],
	_ *AggrInputData,
	top TypeOp[T])

func (*MinStateOp[T]) Init

func (as *MinStateOp[T]) Init(s *State[T])

type MultiplyFunc

type MultiplyFunc struct {
}

func (MultiplyFunc) Register

func (MultiplyFunc) Register(funcList FunctionList)

type NodeOp

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

type NotEqualFunc

type NotEqualFunc struct {
}

func (NotEqualFunc) Register

func (equal NotEqualFunc) Register(funcList FunctionList)

type NotLikeFunc

type NotLikeFunc struct {
}

func (NotLikeFunc) Register

func (like NotLikeFunc) Register(funcList FunctionList)

type NumericTryCast

type NumericTryCast[T any, R any] struct {
	// contains filtered or unexported fields
}

type OperatorExec

type OperatorExec interface {
	Init() error
	Execute(input, output *chunk.Chunk, state *OperatorState) (OperatorResult, error)
	Close() error
}

type OperatorResult

type OperatorResult int
const (
	InvalidOpResult OperatorResult = 0
	NeedMoreInput   OperatorResult = 1

	Done OperatorResult = 3
)

type OperatorType

type OperatorType int

运算符类型

const (
	// 比较运算符
	OpTypeCompare OperatorType = iota
	// 逻辑运算符
	OpTypeLogical
	// 算术运算符
	OpTypeArithmetic
	// 字符串运算符
	OpTypeLike
	// 特殊运算符
	OpTypeSpecial
	// 其它运算符
	OpTypeUnknown
)

func GetOperatorType

func GetOperatorType(name string) OperatorType

type OprAggrState

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

聚合状态

type OprBaseState

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

基础状态

type OprFilterState

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

过滤状态

type OprInsertState

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

插入状态

type OprJoinState

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

连接状态

type OprLimitState

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

限制状态

type OprProjectState

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

type OprScanState

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

扫描状态

type OprSortState

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

排序状态

type OprStubState

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

type OrderByInfo

type OrderByInfo struct {
	// 排序相关
	Desc bool // 是否降序
}

排序信息 - 用于ORDER BY表达式

type OrderByNullType

type OrderByNullType int
const (
	OBNT_INVALID OrderByNullType = iota
	OBNT_DEFAULT
	OBNT_NULLS_FIRST
	OBNT_NULLS_LAST
)

type OrderType

type OrderType int
const (
	OT_INVALID OrderType = iota
	OT_DEFAULT
	OT_ASC
	OT_DESC
)

type PDQConstants

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

func NewPDQConstants

func NewPDQConstants(
	entrySize int,
	compOffset int,
	compSize int,
	end unsafe.Pointer,
) *PDQConstants

func (*PDQConstants) Close

func (pconst *PDQConstants) Close()

type PDQIterator

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

func NewPDQIterator

func NewPDQIterator(ptr unsafe.Pointer, entrySize int) *PDQIterator

type POT

type POT int
const (
	POT_Project      POT = 0
	POT_With         POT = 1
	POT_Filter       POT = 2
	POT_Agg          POT = 3
	POT_Join         POT = 4
	POT_Order        POT = 5
	POT_Limit        POT = 6
	POT_Scan         POT = 7
	POT_Stub         POT = 8 //test stub
	POT_CreateSchema POT = 9
	POT_CreateTable  POT = 10
	POT_Insert       POT = 11
)

func (POT) String

func (t POT) String() string

type Padding

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

func (*Padding) AddPad

func (fc *Padding) AddPad()

func (*Padding) RestorePad

func (fc *Padding) RestorePad()

type PayloadScanner

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

func NewPayloadScanner

func NewPayloadScanner(
	sortedData *SortedData,
	lstate *LocalSort,
	flush bool,
) *PayloadScanner

func (*PayloadScanner) Remaining

func (scan *PayloadScanner) Remaining() int

func (*PayloadScanner) Scan

func (scan *PayloadScanner) Scan(output *chunk.Chunk)

func (*PayloadScanner) Scanned

func (scan *PayloadScanner) Scanned() int

type PhysicalOperator

type PhysicalOperator struct {
	Typ POT
	Tag int //relationTag
	Id  int

	Index    uint64
	Index2   uint64
	Database string
	Table    string // table
	Name     string // column
	Alias    string // alias
	JoinTyp  LOT_JoinType
	Outputs  []*Expr
	Columns  []string // name of project
	Projects []*Expr
	Filters  []*Expr
	Aggs     []*Expr
	GroupBys []*Expr
	OnConds  []*Expr
	OrderBys []*Expr
	Limit    *Expr
	Offset   *Expr

	ChunkCount  int //for stub
	IfNotExists bool
	ColDefs     []*storage.ColumnDefinition //for create table
	Constraints []*storage.Constraint       //for create table
	TableEnt    *storage.CatalogEntry
	ScanTyp     ScanType
	Types       []common.LType //for insert ... values

	ColName2Idx map[string]int
	InsertTypes []common.LType //for insert ... values
	//column seq no in table -> column seq no in Insert
	ColumnIndexMap []int //for insert
	ScanInfo       *ScanInfo
	Children       []*PhysicalOperator
	ExecStats      ExecStats
	// contains filtered or unexported fields
}

func (*PhysicalOperator) String

func (po *PhysicalOperator) String() string

type QueryGraph

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

func NewQueryGraph

func NewQueryGraph() *QueryGraph

func (*QueryGraph) CreateEdge

func (graph *QueryGraph) CreateEdge(left, right *JoinRelationSet, info *FilterInfo)

func (*QueryGraph) GetConnections

func (graph *QueryGraph) GetConnections(node, other *JoinRelationSet) (conns []*neighborInfo)

func (*QueryGraph) GetNeighbors

func (graph *QueryGraph) GetNeighbors(node *JoinRelationSet, excludeSet UnorderedSet) (ret []uint64)

func (*QueryGraph) String

func (graph *QueryGraph) String() string

type RadixPartitionedHashTable

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

func NewRadixPartitionedHashTable

func NewRadixPartitionedHashTable(
	groupingSet GroupingSet,
	aggrData *GroupedAggrData,
) *RadixPartitionedHashTable

func (*RadixPartitionedHashTable) FetchAggregates

func (rpht *RadixPartitionedHashTable) FetchAggregates(groups, result *chunk.Chunk)

func (*RadixPartitionedHashTable) Finalize

func (rpht *RadixPartitionedHashTable) Finalize()

func (*RadixPartitionedHashTable) GetData

func (rpht *RadixPartitionedHashTable) GetData(state *TupleDataScanState, output, childrenOutput *chunk.Chunk) OperatorResult

func (*RadixPartitionedHashTable) SetGroupingValues

func (rpht *RadixPartitionedHashTable) SetGroupingValues()

func (*RadixPartitionedHashTable) Sink

func (rpht *RadixPartitionedHashTable) Sink(data, payload, childrenOutput *chunk.Chunk, filter []int)

type ReferredColumnBindMap

type ReferredColumnBindMap map[ColumnBind][]*Expr

func (ReferredColumnBindMap) String

func (ref ReferredColumnBindMap) String() string

type RelationAttributes

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

func NewRelationAttributes

func NewRelationAttributes() *RelationAttributes

type RelationToTDom

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

func NewRelationToTDom

func NewRelationToTDom(cset ColumnBindSet) *RelationToTDom

type RowDataBlock

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

func NewRowDataBlock

func NewRowDataBlock(capacity int, entrySize int) *RowDataBlock

func (*RowDataBlock) Close

func (block *RowDataBlock) Close()

func (*RowDataBlock) Copy

func (block *RowDataBlock) Copy() *RowDataBlock

type RowDataCollection

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

func NewRowDataCollection

func NewRowDataCollection(bcap int, entSize int) *RowDataCollection

func (*RowDataCollection) AppendToBlock

func (cdc *RowDataCollection) AppendToBlock(
	block *RowDataBlock,
	appendEntries *[]BlockAppendEntry,
	remaining int,
	entrySizes []int) int

func (*RowDataCollection) Build

func (cdc *RowDataCollection) Build(
	addedCnt int,
	keyLocs []unsafe.Pointer,
	entrySizes []int,
	sel *chunk.SelectVector)

func (*RowDataCollection) Close

func (cdc *RowDataCollection) Close()

func (*RowDataCollection) CreateBlock

func (cdc *RowDataCollection) CreateBlock() *RowDataBlock

type RowDataCollectionScanner

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

func NewRowDataCollectionScanner

func NewRowDataCollectionScanner(
	row *RowDataCollection,
	heap *RowDataCollection,
	layout *RowLayout,
	flush bool,
) *RowDataCollectionScanner

func (*RowDataCollectionScanner) Count

func (scan *RowDataCollectionScanner) Count() int

func (*RowDataCollectionScanner) Remaining

func (scan *RowDataCollectionScanner) Remaining() int

func (*RowDataCollectionScanner) Reset

func (scan *RowDataCollectionScanner) Reset(flush bool)

func (*RowDataCollectionScanner) Scan

func (scan *RowDataCollectionScanner) Scan(output *chunk.Chunk)

func (*RowDataCollectionScanner) Scanned

func (scan *RowDataCollectionScanner) Scanned() int

type RowLayout

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

func NewRowLayout

func NewRowLayout(types []common.LType, aggrObjs []*AggrObject) *RowLayout

func (*RowLayout) AllConstant

func (lay *RowLayout) AllConstant() bool

func (*RowLayout) CoumnCount

func (lay *RowLayout) CoumnCount() int

func (*RowLayout) GetHeapOffset

func (lay *RowLayout) GetHeapOffset() int

func (*RowLayout) GetOffsets

func (lay *RowLayout) GetOffsets() []int

func (*RowLayout) GetTypes

func (lay *RowLayout) GetTypes() []common.LType

type Runner

type Runner struct {
	Txn *storage.Txn
	// contains filtered or unexported fields
}

func InitRunner

func InitRunner(cfg *util.Config, txn *storage.Txn, query string) (*Runner, error)

func (*Runner) Close

func (run *Runner) Close() error

func (*Runner) Columns

func (run *Runner) Columns() wire.Columns

func (*Runner) Execute

func (run *Runner) Execute(input, output *chunk.Chunk, state *OperatorState) (OperatorResult, error)

func (*Runner) Init

func (run *Runner) Init() error

func (*Runner) Run

func (run *Runner) Run(
	ctx context.Context,
	writer wire.DataWriter) error

type ScalarFunc

type ScalarFunc func(*chunk.Chunk, *ExprState, *chunk.Vector)

func BinaryFunction

func BinaryFunction[T, S, R any](
	op BinaryOp[T, S, R],
) ScalarFunc

func ExecuteStandard

func ExecuteStandard[T, S, R any](
	op BinaryOp[T, S, R],
) ScalarFunc

func GetScalarBinaryAddFunction

func GetScalarBinaryAddFunction(ptyp common.PhyType, checkOverflow bool) ScalarFunc

func GetScalarBinaryAddFunctionWithOverflowCheck

func GetScalarBinaryAddFunctionWithOverflowCheck(ptyp common.PhyType) ScalarFunc

func GetScalarBinaryAddFunctionWithoutOverflowCheck

func GetScalarBinaryAddFunctionWithoutOverflowCheck(ptyp common.PhyType) ScalarFunc

func GetScalarBinaryFunction

func GetScalarBinaryFunction(ptyp common.PhyType, opKind string, checkOverflow bool) ScalarFunc

func GetScalarBinaryMulFunction

func GetScalarBinaryMulFunction(ptyp common.PhyType, overflow bool) ScalarFunc

func GetScalarBinaryMulFunctionWithOverflow

func GetScalarBinaryMulFunctionWithOverflow(ptyp common.PhyType) ScalarFunc

func GetScalarBinaryMulFunctionWithoutOverflow

func GetScalarBinaryMulFunctionWithoutOverflow(ptyp common.PhyType) ScalarFunc

func GetScalarBinarySubFunction

func GetScalarBinarySubFunction(ptyp common.PhyType, overflow bool) ScalarFunc

func GetScalarBinarySubFunctionWithOverflow

func GetScalarBinarySubFunctionWithOverflow(ptyp common.PhyType) ScalarFunc

func GetScalarBinarySubFunctionWithoutOverflow

func GetScalarBinarySubFunctionWithoutOverflow(ptyp common.PhyType) ScalarFunc

func GetScalarIntegerAddFunction

func GetScalarIntegerAddFunction(ptyp common.PhyType, checkOverflow bool) ScalarFunc

func GetScalarIntegerAddFunctionWithOverflowCheck

func GetScalarIntegerAddFunctionWithOverflowCheck(ptyp common.PhyType) ScalarFunc

func GetScalarIntegerAddFunctionWithoutOverflowCheck

func GetScalarIntegerAddFunctionWithoutOverflowCheck(ptyp common.PhyType) ScalarFunc

func GetScalarIntegerFunction

func GetScalarIntegerFunction(ptyp common.PhyType, opKind string, checkOverflow bool) ScalarFunc

func GetScalarIntegerMulFunction

func GetScalarIntegerMulFunction(ptyp common.PhyType, overflow bool) ScalarFunc

func GetScalarIntegerMulFunctionWithOverflow

func GetScalarIntegerMulFunctionWithOverflow(ptyp common.PhyType) ScalarFunc

func GetScalarIntegerMulFunctionWithoutOverflow

func GetScalarIntegerMulFunctionWithoutOverflow(ptyp common.PhyType) ScalarFunc

func GetScalarIntegerSubFunction

func GetScalarIntegerSubFunction(ptyp common.PhyType, overflow bool) ScalarFunc

func GetScalarIntegerSubFunctionWithOverflow

func GetScalarIntegerSubFunctionWithOverflow(ptyp common.PhyType) ScalarFunc

func GetScalarIntegerSubFunctionWithoutOverflow

func GetScalarIntegerSubFunctionWithoutOverflow(ptyp common.PhyType) ScalarFunc

func GetScalarUnaryFunction

func GetScalarUnaryFunction(typ common.LType, opKind string) ScalarFunc

func GetScalarUnarySubFunction

func GetScalarUnarySubFunction(typ common.LType) ScalarFunc

func TernaryExecStandard

func TernaryExecStandard[A any, B any, C any, R any](
	op TernaryOp[A, B, C, R],
) ScalarFunc

func TernaryFunction

func TernaryFunction[A any, B any, C any, R any](
	op TernaryOp[A, B, C, R],
) ScalarFunc

func UnaryFunction

func UnaryFunction[T any, R any](
	op UnaryOp[T, R]) ScalarFunc

type Scan

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

func NewScan

func NewScan(ht *JoinHashTable) *Scan

func (*Scan) InnerJoin

func (scan *Scan) InnerJoin(keys *chunk.Chunk, resVec *chunk.SelectVector) int

func (*Scan) Next

func (scan *Scan) Next(keys, left, result *chunk.Chunk)

func (*Scan) NextAntiJoin

func (scan *Scan) NextAntiJoin(keys, left, result *chunk.Chunk)

func (*Scan) NextInnerJoin

func (scan *Scan) NextInnerJoin(keys, left, result *chunk.Chunk)

func (*Scan) NextLeftJoin

func (scan *Scan) NextLeftJoin(keys, left, result *chunk.Chunk)

func (*Scan) NextMarkJoin

func (scan *Scan) NextMarkJoin(keys, left, result *chunk.Chunk)

func (*Scan) NextSemiJoin

func (scan *Scan) NextSemiJoin(keys, left, result *chunk.Chunk)

func (*Scan) NextSemiOrAntiJoin

func (scan *Scan) NextSemiOrAntiJoin(keys, left, result *chunk.Chunk, Match bool)

func (*Scan) ScanKeyMatches

func (scan *Scan) ScanKeyMatches(keys *chunk.Chunk)

type ScanInfo

type ScanInfo struct {
	ReturnedTypes []common.LType
	Names         []string
	ColumnIds     []int
	FilePath      string
	Opts          []*ScanOption
	Format        string //for CopyFrom
}

type ScanOption

type ScanOption struct {
	Kind string
	Opt  string
}

type ScanState

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

type ScanType

type ScanType int
const (
	ScanTypeTable      ScanType = 0
	ScanTypeValuesList ScanType = 1
	ScanTypeCopyFrom   ScanType = 2
)

func (ScanType) String

func (st ScanType) String() string

type SingleJoinRelation

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

type SinkResult

type SinkResult int
const (
	SinkResNeedMoreInput SinkResult = iota
	SinkResDone
)

type SortLayout

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

func NewSortLayout

func NewSortLayout(orders []*Expr) *SortLayout

type SortState

type SortState int
const (
	SS_INIT SortState = iota
	SS_SORT
	SS_SCAN
)

type SortedBlock

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

func NewSortedBlock

func NewSortedBlock(sortLayout *SortLayout, payloadLayout *RowLayout) *SortedBlock

type SortedData

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

func NewSortedData

func NewSortedData(typ SortedDataType, layout *RowLayout) *SortedData

func (SortedData) Count

func (d SortedData) Count() int

type SortedDataType

type SortedDataType int
const (
	SDT_BLOB    SortedDataType = 0
	SDT_PAYLOAD SortedDataType = 1
)

type SourceResult

type SourceResult int
const (
	SrcResHaveMoreOutput SourceResult = iota
	SrcResDone
)

type SourceType

type SourceType int
const (
	ThisNode   SourceType = 0
	LeftChild  SourceType = -1 //also for one child
	RightChild SourceType = -2
)

type State

type State[T any] struct {
	// contains filtered or unexported fields
}

func (*State[T]) Combine

func (state *State[T]) Combine(other *State[T], add TypeOp[T])

func (*State[T]) GetIsset

func (state *State[T]) GetIsset() bool

func (*State[T]) GetValue

func (state *State[T]) GetValue() T

func (*State[T]) Init

func (state *State[T]) Init()

func (*State[T]) SetIsset

func (state *State[T]) SetIsset(b bool)

func (*State[T]) SetValue

func (state *State[T]) SetValue(val T)

type StateOp

type StateOp[T any] interface {
	Init(*State[T])
	Combine(*State[T], *State[T], *AggrInputData, TypeOp[T])
	AddValues(*State[T], int)
}

type StateType

type StateType int
const (
	STATE_SUM StateType = iota
	STATE_AVG
	STATE_COUNT
	STATE_MAX
	STATE_MIN
)

type Stats

type Stats struct {
	RowCount float64
	ColStats []*BaseStats
}

func (*Stats) Copy

func (s *Stats) Copy() *Stats

func (*Stats) String

func (s *Stats) String() string

type SubFunc

type SubFunc struct {
}

func (SubFunc) Func

func (sub SubFunc) Func(typ common.LType) *Function

func (SubFunc) Func2

func (sub SubFunc) Func2(lTyp, rTyp common.LType) *Function

func (SubFunc) Register

func (sub SubFunc) Register(funcList FunctionList)

type Subgraph2Denominator

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

func NewSubgraph2Denominator

func NewSubgraph2Denominator() *Subgraph2Denominator

type SubqueryInfo

type SubqueryInfo struct {
	// 子查询构建和执行
	SubBuilder  *Builder        // 子查询的构建器
	SubCtx      *BindContext    // 子查询的绑定上下文
	SubqueryTyp ET_SubqueryType // 子查询类型(标量/EXISTS/IN等)
}

子查询信息 - 用于子查询表达式

type SubstringFunc

type SubstringFunc struct {
}

func (SubstringFunc) Register

func (SubstringFunc) Register(funcList FunctionList)

type SumFunc

type SumFunc struct {
}

func (SumFunc) Register

func (SumFunc) Register(funcList FunctionList)

type SumOp

type SumOp[ResultT any, InputT any] struct {
}

func (SumOp[ResultT, InputT]) Combine

func (s SumOp[ResultT, InputT]) Combine(
	src *State[ResultT],
	target *State[ResultT],
	data *AggrInputData,
	sop StateOp[ResultT],
	top TypeOp[ResultT])

func (SumOp[ResultT, InputT]) ConstantOperation

func (s SumOp[ResultT, InputT]) ConstantOperation(
	s3 *State[ResultT],
	input *InputT,
	data *AggrUnaryInput,
	count int,
	sop StateOp[ResultT],
	aop AddOp[ResultT, InputT],
	top TypeOp[ResultT])

func (SumOp[ResultT, InputT]) Finalize

func (s SumOp[ResultT, InputT]) Finalize(
	s3 *State[ResultT],
	target *ResultT,
	data *AggrFinalizeData)

func (SumOp[ResultT, InputT]) IgnoreNull

func (s SumOp[ResultT, InputT]) IgnoreNull() bool

func (SumOp[ResultT, InputT]) Init

func (s SumOp[ResultT, InputT]) Init(
	s2 *State[ResultT],
	sop StateOp[ResultT])

func (SumOp[ResultT, InputT]) Operation

func (s SumOp[ResultT, InputT]) Operation(
	s3 *State[ResultT],
	input *InputT,
	data *AggrUnaryInput,
	sop StateOp[ResultT],
	aop AddOp[ResultT, InputT],
	top TypeOp[ResultT])

type SumStateOp

type SumStateOp[T any] struct {
}

func (SumStateOp[T]) AddValues

func (SumStateOp[T]) AddValues(s *State[T], _ int)

func (SumStateOp[T]) Combine

func (SumStateOp[T]) Combine(
	src *State[T],
	target *State[T],
	_ *AggrInputData,
	top TypeOp[T])

func (SumStateOp[T]) Init

func (SumStateOp[T]) Init(s *State[T])

type TableFilterSet

type TableFilterSet struct {
}

type TableInfo

type TableInfo struct {
	// 表定义和约束
	TabEnt      *storage.CatalogEntry // 表目录条目
	ColName2Idx map[string]int        // 列名到索引的映射
	Constraints []*storage.Constraint // 表约束
}

表信息 - 用于表表达式

type TernaryFunc

type TernaryFunc[A any, B any, C any, R any] func(*A, *B, *C, *R)

type TernaryLambdaWrapper

type TernaryLambdaWrapper[A any, B any, C any, R any] struct {
	// contains filtered or unexported fields
}

type TernaryOp

type TernaryOp[A any, B any, C any, R any] func(*A, *B, *C, *R)

type TernaryStandardOperatorWrapper

type TernaryStandardOperatorWrapper[A any, B any, C any, R any] struct {
	// contains filtered or unexported fields
}

type TernaryWrapper

type TernaryWrapper[A any, B any, C any, R any] interface {
	// contains filtered or unexported methods
}

type TupleDataAllocator

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

func NewTupleDataAllocator

func NewTupleDataAllocator(bufferMgr *storage.BufferManager, layout *TupleDataLayout) *TupleDataAllocator

func (*TupleDataAllocator) Build

func (alloc *TupleDataAllocator) Build(
	segment *TupleDataSegment,
	pinState *TupleDataPinState,
	chunkState *TupleDataChunkState,
	appendOffset uint64,
	appendCount uint64,
)

func (*TupleDataAllocator) BuildChunkPart

func (alloc *TupleDataAllocator) BuildChunkPart(
	pinState *TupleDataPinState,
	chunkState *TupleDataChunkState,
	appendOffset uint64,
	appendCount uint64,
) *TupleDataChunkPart

BuildChunkPart allocate space for rows

func (*TupleDataAllocator) GetBaseHeapPointer

func (alloc *TupleDataAllocator) GetBaseHeapPointer(
	pinState *TupleDataPinState,
	part *TupleDataChunkPart) unsafe.Pointer

func (*TupleDataAllocator) GetRowPointer

func (alloc *TupleDataAllocator) GetRowPointer(
	pinState *TupleDataPinState,
	part *TupleDataChunkPart) unsafe.Pointer

func (*TupleDataAllocator) InitChunkState

func (alloc *TupleDataAllocator) InitChunkState(
	seg *TupleDataSegment,
	pinState *TupleDataPinState,
	chunkState *TupleDataChunkState,
	chunkIdx int,
	initHeap bool,
)

func (*TupleDataAllocator) InitChunkStateInternal

func (alloc *TupleDataAllocator) InitChunkStateInternal(
	pinState *TupleDataPinState,
	chunkState *TupleDataChunkState,
	offset uint64,
	recompute bool,
	initHeapPointers bool,
	initHeapSizes bool,
	parts []*TupleDataChunkPart,
)

InitChunkStateInternal evaluate the base ptr of rows

func (*TupleDataAllocator) PinHeapBlock

func (alloc *TupleDataAllocator) PinHeapBlock(
	pinState *TupleDataPinState,
	part *TupleDataChunkPart) *storage.BufferHandle

PinHeapBlock let the TupleDataPinState refers to the heap block saved in the TupleDataAllocator and Pin the heap block

func (*TupleDataAllocator) PinRowBlock

func (alloc *TupleDataAllocator) PinRowBlock(
	pinState *TupleDataPinState,
	part *TupleDataChunkPart) *storage.BufferHandle

PinRowBlock let the TupleDataPinState refers to the saved block saved in the TupleDataAllocator and Pin the row block

func (*TupleDataAllocator) ReleaseOrStoreHandles

func (alloc *TupleDataAllocator) ReleaseOrStoreHandles(
	pinState *TupleDataPinState,
	segment *TupleDataSegment,
	chunk *TupleDataChunk,
	releaseHeap bool,
)

ReleaseOrStoreHandles recycle the block unused in pin state to segment pinned blocks

func (*TupleDataAllocator) ReleaseOrStoreHandles2

func (alloc *TupleDataAllocator) ReleaseOrStoreHandles2(
	segment *TupleDataSegment,
	pinnedHandles *[]*storage.BufferHandle,
	handles map[uint32]*storage.BufferHandle,
	blockIds UnorderedSet,
	blocks []*TupleDataBlock,
	prop TupleDataPinProperties,
)

type TupleDataBlock

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

func NewTupleDataBlock

func NewTupleDataBlock(bufferMgr *storage.BufferManager, cap uint64) *TupleDataBlock

func (*TupleDataBlock) Close

func (block *TupleDataBlock) Close()

func (*TupleDataBlock) RemainingCapacity

func (block *TupleDataBlock) RemainingCapacity() uint64

func (*TupleDataBlock) RemainingRows

func (block *TupleDataBlock) RemainingRows(rowWidth uint64) uint64

type TupleDataChunk

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

func NewTupleDataChunk

func NewTupleDataChunk() *TupleDataChunk

func (*TupleDataChunk) AddPart

func (chunk *TupleDataChunk) AddPart(
	part *TupleDataChunkPart,
	layout *TupleDataLayout)

type TupleDataChunkIterator

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

func NewTupleDataChunkIterator

func NewTupleDataChunkIterator(
	collection *TupleDataCollection,
	prop TupleDataPinProperties,
	from, to int,
	initHeap bool,
) *TupleDataChunkIterator

func NewTupleDataChunkIterator2

func NewTupleDataChunkIterator2(
	collection *TupleDataCollection,
	prop TupleDataPinProperties,
	initHeap bool,
) *TupleDataChunkIterator

func (*TupleDataChunkIterator) Done

func (iter *TupleDataChunkIterator) Done() bool

func (*TupleDataChunkIterator) GetChunkState

func (iter *TupleDataChunkIterator) GetChunkState() *TupleDataChunkState

func (*TupleDataChunkIterator) GetCurrentChunkCount

func (iter *TupleDataChunkIterator) GetCurrentChunkCount() int

func (*TupleDataChunkIterator) GetRowLocations

func (iter *TupleDataChunkIterator) GetRowLocations() []unsafe.Pointer

func (*TupleDataChunkIterator) InitCurrentChunk

func (iter *TupleDataChunkIterator) InitCurrentChunk()

func (*TupleDataChunkIterator) Next

func (iter *TupleDataChunkIterator) Next() bool

func (*TupleDataChunkIterator) Reset

func (iter *TupleDataChunkIterator) Reset()

type TupleDataChunkPart

type TupleDataChunkPart struct {
	sync.Mutex
	// contains filtered or unexported fields
}

type TupleDataChunkState

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

func NewTupleDataChunkState

func NewTupleDataChunkState(cnt, childrenOutputCnt int) *TupleDataChunkState

type TupleDataCollection

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

func NewTupleDataCollection

func NewTupleDataCollection(layout *TupleDataLayout) *TupleDataCollection

func (*TupleDataCollection) Append

func (tuple *TupleDataCollection) Append(
	pinState *TupleDataPinState,
	chunkState *TupleDataChunkState,
	chunk *chunk.Chunk,
	appendSel *chunk.SelectVector,
	appendCount int,
)

func (*TupleDataCollection) AppendUnified

func (tuple *TupleDataCollection) AppendUnified(
	pinState *TupleDataPinState,
	chunkState *TupleDataChunkState,
	chunk *chunk.Chunk,
	childrenOutput *chunk.Chunk,
	appendSel *chunk.SelectVector,
	cnt int)

func (*TupleDataCollection) Build

func (tuple *TupleDataCollection) Build(
	pinState *TupleDataPinState,
	chunkState *TupleDataChunkState,
	appendOffset uint64,
	appendCount uint64,
)

Build allocate space for chunk may create new segment or new block

func (*TupleDataCollection) ChunkCount

func (tuple *TupleDataCollection) ChunkCount() int

func (*TupleDataCollection) Count

func (tuple *TupleDataCollection) Count() int

func (*TupleDataCollection) FinalizePinState

func (tuple *TupleDataCollection) FinalizePinState(pinState *TupleDataPinState)

func (*TupleDataCollection) FinalizePinState2

func (tuple *TupleDataCollection) FinalizePinState2(pinState *TupleDataPinState, seg *TupleDataSegment)

func (*TupleDataCollection) Gather

func (tuple *TupleDataCollection) Gather(
	layout *TupleDataLayout,
	rowLocs *chunk.Vector,
	scanSel *chunk.SelectVector,
	scanCnt int,
	colIds []int,
	result *chunk.Chunk,
	targetSel *chunk.SelectVector,
)

func (*TupleDataCollection) InitAppend

func (tuple *TupleDataCollection) InitAppend(pinState *TupleDataPinState, prop TupleDataPinProperties)

func (*TupleDataCollection) InitScan

func (tuple *TupleDataCollection) InitScan(state *TupleDataScanState)

func (*TupleDataCollection) NextScanIndex

func (tuple *TupleDataCollection) NextScanIndex(
	state *TupleDataScanState,
	segIdx *int,
	chunkIdx *int) bool

func (*TupleDataCollection) Scan

func (tuple *TupleDataCollection) Scan(state *TupleDataScanState, result *chunk.Chunk) bool

func (*TupleDataCollection) ScanAtIndex

func (tuple *TupleDataCollection) ScanAtIndex(
	pinState *TupleDataPinState,
	chunkState *TupleDataChunkState,
	colIdxs []int,
	segIndx, chunkIndx int,
	result *chunk.Chunk)

func (*TupleDataCollection) Unpin

func (tuple *TupleDataCollection) Unpin()

type TupleDataLayout

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

TupleDataLayout format:

				bitmap | heap_size_offset? | data columns | aggr fields |
                |------|----------------------------------|-------------|
                  |                |                               |    |
                  |                |                               |    |

bitmapWidth-----------| | | | dataWidth------------------------------| | | aggrWidth--------------------------------------------------------------| | rowWidth--------------------------------------------------------------------|

offsets: start of data columns and aggr fields

func NewTupleDataLayout

func NewTupleDataLayout(types []common.LType, aggrObjs []*AggrObject, childrenOutputTypes []common.LType, align bool, needHeapOffset bool) *TupleDataLayout

type TupleDataPinProperties

type TupleDataPinProperties int
const (
	PIN_PRRP_INVALID     TupleDataPinProperties = 0
	PIN_PRRP_KEEP_PINNED TupleDataPinProperties = 1
)

type TupleDataPinState

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

func NewTupleDataPinState

func NewTupleDataPinState() *TupleDataPinState

type TupleDataScanState

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

func NewTupleDataScanState

func NewTupleDataScanState(colCnt int, prop TupleDataPinProperties) *TupleDataScanState

type TupleDataSegment

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

func NewTupleDataSegment

func NewTupleDataSegment(alloc *TupleDataAllocator) *TupleDataSegment

func (*TupleDataSegment) ChunkCount

func (segment *TupleDataSegment) ChunkCount() int

func (*TupleDataSegment) Unpin

func (segment *TupleDataSegment) Unpin()

type TypeOp

type TypeOp[T any] interface {
	Add(*T, *T)
	Mul(*T, *T)
	Less(*T, *T) bool
	Greater(*T, *T) bool
}

type UnaryData

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

type UnaryFunc

type UnaryFunc[T any, R any] func(input *T, result *R)

type UnaryLambdaWrapper

type UnaryLambdaWrapper[T any, R any] struct {
	// contains filtered or unexported fields
}

type UnaryOp

type UnaryOp[T any, R any] func(input *T, result *R)

type UnaryOp2

type UnaryOp2[T any, R any] func(input *T, result *R, mask *util.Bitmap, idx int, data *UnaryData)

type UnaryOperatorWrapper

type UnaryOperatorWrapper[T any, R any] struct {
	// contains filtered or unexported fields
}

type UnaryWrapper

type UnaryWrapper[T any, R any] interface {
	// contains filtered or unexported methods
}

type UnorderedSet

type UnorderedSet map[uint64]bool

type ValuesListInfo

type ValuesListInfo struct {
	// 值列表定义
	Types  []common.LType // 列类型
	Names  []string       // 列名
	Values [][]*Expr      // 值列表
}

值列表信息 - 用于INSERT VALUES语句

type VectorTryCastData

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

Jump to

Keyboard shortcuts

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