Documentation
¶
Overview ¶
Copyright 2024 Matrix Origin
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func AddColumn(ctx CompilerContext, alterPlan *plan.AlterTable, spec *tree.AlterAddCol, ...) (bool, error)
- func AddPrimaryKey(ctx CompilerContext, alterPlan *plan.AlterTable, spec *tree.PrimaryKeyIndex, ...) error
- func AdjustNDV(info *TableStatsInfo, tableDef *TableDef, s *pb.StatsInfo)
- func AlterColumn(ctx CompilerContext, alterPlan *plan.AlterTable, ...) (bool, error)
- func AssignAuxIdForExpr(expr *plan.Expr, start int32) int32
- func BindFuncExprImplByPlanExpr(ctx context.Context, name string, args []*Expr) (*plan.Expr, error)
- func BuildVectorsByData(datas [][2]any, dataTypes []uint8, mp *mpool.MPool) []*vector.Vector
- func ByteSliceToUint64(bytes []byte) uint64
- func CalcNodeDOP(p *plan.Plan, rootID int32, ncpu int32, lencn int)
- func CalcQueryDOP(p *plan.Plan, ncpu int32, lencn int, typ ExecType)
- func CalcRangeShuffleIDXForObj(rsp *engine.RangesShuffleParam, objstats *objectio.ObjectStats, bucketNum int) uint64
- func ChangeColumn(cctx CompilerContext, alterPlan *plan.AlterTable, ...) (bool, error)
- func ConstantFold(bat *batch.Batch, expr *plan.Expr, proc *process.Process, ...) (*plan.Expr, error)
- func ConstantTranspose(expr *plan.Expr, proc *process.Process) (*plan.Expr, error)
- func ConstructCreateTableSQL(ctx CompilerContext, tableDef *plan.TableDef, snapshot *Snapshot, ...) (string, tree.Statement, error)
- func CreateIndexDef(ctx planplugin.CompilerContext, indexInfo *tree.Index, ...) (*plan.IndexDef, error)
- func DbNameOfObjRef(objRef *ObjectRef) string
- func DeepCopyAnalyzeInfo(analyzeinfo *plan.AnalyzeInfo) *plan.AnalyzeInfo
- func DeepCopyClusterTable(cluster *plan.ClusterTable) *plan.ClusterTable
- func DeepCopyColData(col *plan.ColData) *plan.ColData
- func DeepCopyColDef(col *plan.ColDef) *plan.ColDef
- func DeepCopyColDefList(colDefs []*plan.ColDef) []*plan.ColDef
- func DeepCopyDataDefinition(old *plan.DataDefinition) *plan.DataDefinition
- func DeepCopyDedupJoinCtx(ctx *plan.DedupJoinCtx) *plan.DedupJoinCtx
- func DeepCopyDefault(def *plan.Default) *plan.Default
- func DeepCopyDeleteCtx(ctx *plan.DeleteCtx) *plan.DeleteCtx
- func DeepCopyDropTable(src *plan.DropTable) *plan.DropTable
- func DeepCopyGeneratedCol(old *plan.GeneratedCol) *plan.GeneratedCol
- func DeepCopyIndexDef(indexDef *plan.IndexDef) *plan.IndexDef
- func DeepCopyIndexOption(indexOption *plan.IndexOption) *plan.IndexOption
- func DeepCopyIndexReaderParam(oldParam *plan.IndexReaderParam) *plan.IndexReaderParam
- func DeepCopyInsertCtx(ctx *plan.InsertCtx) *plan.InsertCtx
- func DeepCopyLockTarget(target *plan.LockTarget) *plan.LockTarget
- func DeepCopyNode(node *plan.Node) *plan.Node
- func DeepCopyObjectRef(ref *plan.ObjectRef) *plan.ObjectRef
- func DeepCopyOnUpdate(old *plan.OnUpdate) *plan.OnUpdate
- func DeepCopyOrderBySpec(orderBy *plan.OrderBySpec) *plan.OrderBySpec
- func DeepCopyOrderBySpecList(orderByList []*plan.OrderBySpec) []*plan.OrderBySpec
- func DeepCopyPreInsertCtx(ctx *plan.PreInsertCtx) *plan.PreInsertCtx
- func DeepCopyPreInsertUkCtx(ctx *plan.PreInsertUkCtx) *plan.PreInsertUkCtx
- func DeepCopyPrimaryKeyDef(pkeyDef *plan.PrimaryKeyDef) *plan.PrimaryKeyDef
- func DeepCopyQuery(qry *plan.Query) *plan.Query
- func DeepCopyRankOption(opt *plan.RankOption) *plan.RankOption
- func DeepCopyRuntimeFilterSpec(rf *plan.RuntimeFilterSpec) *plan.RuntimeFilterSpec
- func DeepCopySampleFuncSpec(source *plan.SampleFuncSpec) *plan.SampleFuncSpec
- func DeepCopyStats(stats *plan.Stats) *plan.Stats
- func DeepCopyTableDef(table *plan.TableDef, withCols bool) *plan.TableDef
- func DeepCopyTableDefList(src []*plan.TableDef) []*plan.TableDef
- func DeepCopyType(typ *plan.Type) *plan.Type
- func DeepCopyUpdateCtxList(updateCtxList []*plan.UpdateCtx) []*plan.UpdateCtx
- func DefaultBigStats() *plan.Stats
- func DefaultHugeStats() *plan.Stats
- func DefaultMinimalStats() *plan.Stats
- func DefaultStats() *plan.Stats
- func DefaultValueIsNull(Default *plan.Default) bool
- func DropColumn(ctx CompilerContext, alterPlan *plan.AlterTable, colName string, ...) (bool, error)
- func DropPrimaryKey(ctx CompilerContext, alterPlan *plan.AlterTable, alterCtx *AlterTableContext) error
- func EscapeFormat(s string) string
- func EvalFilterExpr(ctx context.Context, expr *plan.Expr, bat *batch.Batch, proc *process.Process) (bool, error)
- func EvalFoldExpr(proc *process.Process, expr *Expr, executors *[]colexec.ExpressionExecutor) (err error)
- func ExprIsZonemappable(ctx context.Context, expr *plan.Expr) bool
- func ExprType2Type(typ *plan.Type) types.Type
- func ExtractToDateReturnType(format string) (tp types.T, fsp int)
- func Find[T ~string | ~int, S any](data map[T]S, val T) bool
- func FormatColType(colType plan.Type) string
- func FormatExpr(expr *plan.Expr, option FormatOption) string
- func FormatExprInConsole(expr *plan.Expr, option FormatOption) string
- func FormatExprs(exprs []*plan.Expr, option FormatOption) string
- func FormatExprsInConsole(exprs []*plan.Expr, option FormatOption) string
- func FormatViewKeyWithSnapshot(viewKey string, snapshot *Snapshot) string
- func GenConstraintName() string
- func GetBindings(expr *plan.Expr) []int32
- func GetCSVComment(param *tree.ExternParam) string
- func GetCenterValueExtractFromZMSigned(zm objectio.ZoneMap, t types.T) int64
- func GetCenterValueExtractFromZMUnsigned(zm objectio.ZoneMap, t types.T) uint64
- func GetCenterValueForZMSigned(zm objectio.ZoneMap) int64
- func GetCenterValueForZMUnsigned(zm objectio.ZoneMap) uint64
- func GetColExpr(typ Type, relpos int32, colpos int32) *plan.Expr
- func GetColumnMapByExpr(expr *plan.Expr, tableDef *plan.TableDef, columnMap map[int]int)
- func GetColumnMapByExprs(exprs []*plan.Expr, tableDef *plan.TableDef, columnMap map[int]int)
- func GetColumnsByExpr(expr *plan.Expr, tableDef *plan.TableDef) (columnMap map[int]int, defColumns, exprColumns []int, maxCol int)
- func GetFilePathFromParam(param *tree.ExternParam) string
- func GetFkReferredTo(ctx CompilerContext, db, table string) (map[FkReferKey]map[string][]*FkReferDef, error)
- func GetForETLWithType(param *tree.ExternParam, prefix string) (res fileservice.ETLFileService, readPath string, err error)
- func GetForceScanOnMultiCN() bool
- func GetFunctionArgTypeStrFromAst(arg tree.FunctionArg) (string, error)
- func GetFunctionTypeStrFromAst(typRef tree.ResolvableTypeReference) (string, error)
- func GetHashColumn(expr *plan.Expr) (*plan.ColRef, int32)
- func GetInFilterCardLimit(sid string) int32
- func GetInFilterCardLimitOnPK(sid string, tableCnt float64) int32
- func GetPhyPlanTitle(qry *plan.Query, txnHaveDDL bool) string
- func GetPlanTitle(qry *plan.Query, txnHaveDDL bool) string
- func GetRangeShuffleIndexForExtractedZM(minVal, maxVal int64, zm objectio.ZoneMap, upplerLimit uint64, t types.T) uint64
- func GetRangeShuffleIndexForValuesExtractedFromZMSignedSlice(val []int64, zm objectio.ZoneMap, t types.T) uint64
- func GetRangeShuffleIndexForValuesExtractedFromZMUnsignedSlice(val []uint64, zm objectio.ZoneMap, t types.T) uint64
- func GetRangeShuffleIndexForZM(minVal, maxVal int64, zm objectio.ZoneMap, upplerLimit uint64) uint64
- func GetRangeShuffleIndexForZMSignedSlice(val []int64, zm objectio.ZoneMap) uint64
- func GetRangeShuffleIndexForZMUnsignedSlice(val []uint64, zm objectio.ZoneMap) uint64
- func GetRangeShuffleIndexSignedMinMax(minVal, maxVal, currentVal int64, upplerLimit uint64) uint64
- func GetRangeShuffleIndexSignedSlice(val []int64, currentVal int64) uint64
- func GetRangeShuffleIndexUnsignedMinMax(minVal, maxVal, currentVal uint64, upplerLimit uint64) uint64
- func GetRangeShuffleIndexUnsignedSlice(val []uint64, currentVal uint64) uint64
- func GetRowSizeFromTableDef(tableDef *TableDef, ignoreHiddenKey bool) float64
- func GetSortOrder(tableDef *plan.TableDef, colPos int32) int
- func GetSortOrderByName(tableDef *plan.TableDef, colName string) int
- func GetSqlForFkReferredTo(db, table string) string
- func GetUniqueColAndIdxFromTableDef(tableDef *TableDef) ([]map[string]int, map[string]bool)
- func GetWriteFilePattern(param *tree.ExternParam) (string, bool)
- func HasColExpr(expr *plan.Expr, pos int32) int32
- func HasFkSelfReferOnly(tableDef *TableDef) bool
- func HasFoldExprForList(exprs []*Expr) bool
- func HasFoldValExpr(expr *Expr) bool
- func HasMoCtrl(expr *plan.Expr) bool
- func HasShuffleInPlan(qry *plan.Query) bool
- func HasTag(expr *plan.Expr, tag int32) bool
- func IgnoredLines(param *tree.ExternParam, ctx CompilerContext) (offset int64, err error)
- func InitInfileOrStageParam(param *tree.ExternParam, proc *process.Process) error
- func InitInfileParam(param *tree.ExternParam) error
- func InitNullMap(param *tree.ExternParam, ctx CompilerContext) error
- func InitS3Param(param *tree.ExternParam) error
- func InitStageS3Param(param *tree.ExternParam, s stage.StageDef) error
- func InternalTable(tableDef *TableDef) bool
- func IsDefaultStats(stats *plan.Stats) bool
- func IsEqualFunc(id int64) bool
- func IsEquiJoin2(exprs []*plan.Expr) bool
- func IsFalseExpr(e *Expr) bool
- func IsFkBannedDatabase(db string) bool
- func IsFkSelfRefer(fkDbName, fkTableName, curDbName, curTableName string) bool
- func IsForeignKeyChecksEnabled(ctx CompilerContext) (bool, error)
- func IsSnapshotValid(snapshot *Snapshot) bool
- func MakeCPKEYRuntimeFilter(tag int32, upperlimit int32, expr *Expr, tableDef *plan.TableDef, notOnPk bool) *plan.RuntimeFilterSpec
- func MakeInsertValueConstExpr(proc *process.Process, numVal *tree.NumVal, colType *types.Type) (*plan.Expr, error)
- func MakePlan2Decimal64ExprWithType(v types.Decimal64, typ *Type) *plan.Expr
- func MakePlan2Decimal128ExprWithType(v types.Decimal128, typ *Type) *plan.Expr
- func MakePlan2NullTextConstExprWithType(v string) *plan.Expr
- func MakeRuntimeFilter(tag int32, matchPrefix bool, upperlimit int32, expr *Expr, notOnPk bool) *plan.RuntimeFilterSpec
- func MakeSerialRuntimeFilter(ctx context.Context, tag int32, matchPrefix bool, upperlimit int32, expr *Expr, ...) *plan.RuntimeFilterSpec
- func ModifyColumn(cctx CompilerContext, alterPlan *plan.AlterTable, ...) (bool, error)
- func NewShuffleRange(isString bool) *pb.ShuffleRange
- func NewStatsInfo() *pb.StatsInfo
- func OrderByColumn(ctx CompilerContext, alterPlan *plan.AlterTable, ...) error
- func PkColByTableDef(tblDef *plan.TableDef) *plan.ColDef
- func PrintStats(qry *plan.Query) string
- func ReCalcNodeStats(nodeID int32, builder *QueryBuilder, recursive bool, leafNode bool, ...)
- func ReadDir(param *tree.ExternParam) (fileList []string, fileSize []int64, err error)
- func RemoveIf[T any](data []T, pred func(t T) bool) []T
- func RenameColumn(ctx CompilerContext, alterPlan *plan.AlterTable, ...) error
- func ReplaceFoldExpr(proc *process.Process, expr *Expr, exes *[]colexec.ExpressionExecutor) (bool, error)
- func ResetAuxIdForExpr(expr *plan.Expr)
- func ResetPreparePlan(ctx CompilerContext, preparePlan *Plan) ([]*plan.ObjectRef, []int32, error)
- func ResolveAlterTableAlgorithm(ctx context.Context, validAlterSpecs []tree.AlterTableOption, ...) (algorithm plan.AlterTable_AlgorithmType, err error)
- func RewriteCountNotNullColToStarcount(node *plan.Node, tableDef *plan.TableDef)
- func SetForceScanOnMultiCN(v bool)
- func ShouldSkipObjByShuffle(rsp *engine.RangesShuffleParam, objstats *objectio.ObjectStats) bool
- func ShuffleRangeReEvalSigned(ranges []float64, k2 int, nullCnt int64, tableCnt int64) []int64
- func ShuffleRangeReEvalUnsigned(ranges []float64, k2 int, nullCnt int64, tableCnt int64) []uint64
- func SimpleCharHashToRange(bytes []byte, upperLimit uint64) uint64
- func SimpleInt64HashToRange(i uint64, upperLimit uint64) uint64
- func StatFile(param *tree.ExternParam) error
- func UpdateStatsInfo(info *TableStatsInfo, tableDef *plan.TableDef, s *pb.StatsInfo)
- func VarlenaToUint64(v *types.Varlena, area []byte) uint64
- func VarlenaToUint64Inline(v *types.Varlena) uint64
- type AlterTableContext
- type BaseOptimizer
- type BindContext
- type Binder
- type Binding
- type BindingTreeNode
- type CTERef
- type ClusterByDef
- type ClusterTable
- type ColDef
- func FindColumn(cols []*ColDef, name string) *ColDef
- func FindColumnByColId(cols []*ColDef, colId uint64) *ColDef
- func FindColumnByOriginName(cols []*ColDef, originName string) *ColDef
- func GetColDefFromTable(Cols []*ColDef, hidenColName string) *ColDef
- func GetResultColumnsFromPlan(p *Plan) []*ColDef
- func MakeHiddenColDefByName(name string) *ColDef
- func MakeRowIdColDef() *ColDef
- type ColRef
- type ColRefRemapping
- type CompilerContext
- type Const
- type CteBindState
- type DMLContext
- func (dmlCtx *DMLContext) ResolveSingleTable(ctx CompilerContext, tbl tree.TableExpr, aliasMap map[string][2]string, ...) error
- func (dmlCtx *DMLContext) ResolveTables(ctx CompilerContext, tableExprs tree.TableExprs, with *tree.With, ...) error
- func (dmlCtx *DMLContext) ResolveUpdateTables(ctx CompilerContext, stmt *tree.Update) error
- type DefaultBinder
- func (b *DefaultBinder) BindAggFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *DefaultBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *DefaultBinder) BindExpr(astExpr tree.Expr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *DefaultBinder) BindSubquery(astExpr *tree.Subquery, isRoot bool) (*plan.Expr, error)
- func (b *DefaultBinder) BindTimeWindowFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *DefaultBinder) BindWinFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *DefaultBinder) GetContext() context.Context
- type ExecType
- type ExpandAliasMode
- type Expr
- func DeepCopyExpr(expr *Expr) *Expr
- func DeepCopyExprList(list []*Expr) []*Expr
- func GenUniqueColCheckExpr(ctx context.Context, tableDef *TableDef, uniqueCols []map[string]int, ...) ([]*Expr, error)
- func GenUniqueColJoinExpr(ctx context.Context, tableDef *TableDef, uniqueCols []map[string]int, ...) (*Expr, error)
- func MakeFalseExpr() *Expr
- func MakeInExpr(ctx context.Context, left *Expr, length int32, data []byte, matchPrefix bool) *Expr
- func MakeIntervalExpr(num int64, str string) *Expr
- func MakeSerialExtractExpr(ctx context.Context, fromExpr *Expr, origType Type, serialIdx int64) (*Expr, error)
- type ExternAttr
- type FkColName
- type FkData
- type FkReferDef
- type FkReferKey
- type ForeignKeyDef
- type FormatOption
- type GeneratedColBinder
- func (b *GeneratedColBinder) BindAggFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *GeneratedColBinder) BindColRef(astExpr *tree.UnresolvedName, _ int32, _ bool) (*plan.Expr, error)
- func (b *GeneratedColBinder) BindExpr(astExpr tree.Expr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *GeneratedColBinder) BindSubquery(astExpr *tree.Subquery, isRoot bool) (*plan.Expr, error)
- func (b *GeneratedColBinder) BindTimeWindowFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *GeneratedColBinder) BindWinFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *GeneratedColBinder) GetContext() context.Context
- type GetParamRule
- type GroupBinder
- func (b *GroupBinder) BindAggFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *GroupBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *GroupBinder) BindExpr(astExpr tree.Expr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *GroupBinder) BindSubquery(astExpr *tree.Subquery, isRoot bool) (*plan.Expr, error)
- func (b *GroupBinder) BindTimeWindowFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *GroupBinder) BindWinFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *GroupBinder) GetContext() context.Context
- type HavingBinder
- func (b *HavingBinder) BindAggFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *HavingBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *HavingBinder) BindExpr(astExpr tree.Expr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *HavingBinder) BindSubquery(astExpr *tree.Subquery, isRoot bool) (*plan.Expr, error)
- func (b *HavingBinder) BindTimeWindowFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *HavingBinder) BindWinFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *HavingBinder) GetContext() context.Context
- type IndexDef
- type LimitBinder
- func (b *LimitBinder) BindAggFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *LimitBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *LimitBinder) BindExpr(astExpr tree.Expr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *LimitBinder) BindSubquery(astExpr *tree.Subquery, isRoot bool) (*plan.Expr, error)
- func (b *LimitBinder) BindTimeWindowFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *LimitBinder) BindWinFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *LimitBinder) GetContext() context.Context
- type MaxValue
- type MoCacheColType
- type MoConfigColType
- type MoLocksColType
- type MoTransactionsColType
- type MockCompilerContext
- func (m *MockCompilerContext) BuildTableDefByMoColumns(dbName, table string) (*TableDef, error)
- func (m *MockCompilerContext) CheckSubscriptionValid(subName, accName string, pubName string) error
- func (m *MockCompilerContext) CheckTimeStampValid(ts int64) (bool, error)
- func (m *MockCompilerContext) DatabaseExists(name string, snapshot *Snapshot) bool
- func (m *MockCompilerContext) DefaultDatabase() string
- func (m *MockCompilerContext) GetAccountId() (uint32, error)
- func (m *MockCompilerContext) GetAccountName() string
- func (m *MockCompilerContext) GetBuildingAlterView() (bool, string, string)
- func (m *MockCompilerContext) GetContext() context.Context
- func (m *MockCompilerContext) GetDatabaseId(dbName string, snapshot *Snapshot) (uint64, error)
- func (m *MockCompilerContext) GetLowerCaseTableNames() int64
- func (m *MockCompilerContext) GetProcess() *process.Process
- func (m *MockCompilerContext) GetQueryResultMeta(uuid string) ([]*ColDef, string, error)
- func (m *MockCompilerContext) GetQueryingSubscription() *SubscriptionMeta
- func (m *MockCompilerContext) GetRootSql() string
- func (m *MockCompilerContext) GetSnapshot() *Snapshot
- func (m *MockCompilerContext) GetStatsCache() *StatsCache
- func (m *MockCompilerContext) GetSubscriptionMeta(dbName string, snapshot *Snapshot) (*SubscriptionMeta, error)
- func (m *MockCompilerContext) GetUserName() string
- func (m *MockCompilerContext) GetViews() []string
- func (m *MockCompilerContext) InitExecuteStmtParam(execPlan *plan.Execute) (*plan.Plan, tree.Statement, error)
- func (m *MockCompilerContext) IsPublishing(dbName string) (bool, error)
- func (m *MockCompilerContext) Resolve(dbName string, tableName string, snapshot *Snapshot) (*ObjectRef, *TableDef, error)
- func (m *MockCompilerContext) ResolveAccountIds(accountNames []string) ([]uint32, error)
- func (m *MockCompilerContext) ResolveById(tableId uint64, snapshot *Snapshot) (*ObjectRef, *TableDef, error)
- func (m *MockCompilerContext) ResolveIndexTableByRef(ref *ObjectRef, tblName string, snapshot *Snapshot) (*ObjectRef, *TableDef, error)
- func (m *MockCompilerContext) ResolveSnapshotWithSnapshotName(snapshotName string) (*Snapshot, error)
- func (m *MockCompilerContext) ResolveSubscriptionTableById(tableId uint64, pubmeta *SubscriptionMeta) (*ObjectRef, *TableDef, error)
- func (m *MockCompilerContext) ResolveUdf(name string, ast []*plan.Expr) (*function.Udf, error)
- func (m *MockCompilerContext) ResolveVariable(varName string, isSystemVar, isGlobalVar bool) (interface{}, error)
- func (m *MockCompilerContext) SetBuildingAlterView(yesOrNo bool, dbName, viewName string)
- func (m *MockCompilerContext) SetContext(ctx context.Context)
- func (m *MockCompilerContext) SetQueryingSubscription(*SubscriptionMeta)
- func (m *MockCompilerContext) SetSnapshot(snapshot *Snapshot)
- func (m *MockCompilerContext) SetViews(views []string)
- func (m *MockCompilerContext) Stats(obj *ObjectRef, snapshot *Snapshot) (*pb.StatsInfo, error)
- type MockOptimizer
- type MultiTableIndex
- type NameTuple
- type Node
- type ObjectRef
- type OndupUpdateBinder
- func (b *OndupUpdateBinder) BindAggFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *OndupUpdateBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *OndupUpdateBinder) BindExpr(astExpr tree.Expr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *OndupUpdateBinder) BindSubquery(astExpr *tree.Subquery, isRoot bool) (*plan.Expr, error)
- func (b *OndupUpdateBinder) BindTimeWindowFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *OndupUpdateBinder) BindWinFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *OndupUpdateBinder) GetContext() context.Context
- type Optimizer
- type OptimizerHints
- type OrderBinder
- type OrderBySpec
- type OriginTableMessageForFuzzy
- type ParseJsonlOptions
- type ParseJsonlOptionsCol
- type PartitionBinder
- func (p *PartitionBinder) BindAggFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (p *PartitionBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
- func (p *PartitionBinder) BindExpr(astExpr tree.Expr, depth int32, isRoot bool) (*plan.Expr, error)
- func (p *PartitionBinder) BindSubquery(astExpr *tree.Subquery, isRoot bool) (*plan.Expr, error)
- func (p *PartitionBinder) BindTimeWindowFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (p *PartitionBinder) BindWinFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *PartitionBinder) GetContext() context.Context
- type Plan
- type Plan_Query
- type PrimaryKeyDef
- type ProjectionBinder
- func (b *ProjectionBinder) BindAggFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *ProjectionBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *ProjectionBinder) BindExpr(astExpr tree.Expr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *ProjectionBinder) BindSubquery(astExpr *tree.Subquery, isRoot bool) (*plan.Expr, error)
- func (b *ProjectionBinder) BindTimeWindowFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *ProjectionBinder) BindWinFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *ProjectionBinder) GetContext() context.Context
- type PropertiesDef
- type Property
- type Query
- type QueryBuilder
- func (builder *QueryBuilder) AppendNode(node *plan.Node, ctx planplugin.BindContext) int32
- func (builder *QueryBuilder) ApplyIndicesForSortUsingCagra(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef, ...) (int32, bool, error)
- func (builder *QueryBuilder) ApplyIndicesForSortUsingHnsw(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef, ...) (int32, bool, error)
- func (builder *QueryBuilder) ApplyIndicesForSortUsingIvfflat(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef, ...) (int32, bool, error)
- func (builder *QueryBuilder) ApplyIndicesForSortUsingIvfpq(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef, ...) (int32, bool, error)
- func (builder *QueryBuilder) CanApplyCagra(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef) (bool, error)
- func (builder *QueryBuilder) CanApplyHnsw(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef) (bool, error)
- func (builder *QueryBuilder) CanApplyIvfflat(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef) (bool, error)
- func (builder *QueryBuilder) CanApplyIvfpq(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef) (bool, error)
- func (builder *QueryBuilder) GenNewBindTag() int32
- func (builder *QueryBuilder) GetContext() context.Context
- func (builder *QueryBuilder) IsEquiJoin(node *plan.Node) bool
- func (builder *QueryBuilder) ResolveTsHint(tsExpr *tree.AtTimeStamp) (snapshot *Snapshot, err error)
- type RemapInfo
- type ResetParamOrderRule
- type ResetParamRefRule
- type RowsetData
- type Rule
- type SampleFuncCtx
- type Schema
- type SelectField
- type SetBinder
- func (s *SetBinder) BindAggFunc(_ string, expr *tree.FuncExpr, i int32, b bool) (*plan.Expr, error)
- func (s *SetBinder) BindColRef(name *tree.UnresolvedName, i int32, b bool) (*plan.Expr, error)
- func (s *SetBinder) BindExpr(expr tree.Expr, i int32, b bool) (*plan.Expr, error)
- func (s *SetBinder) BindSubquery(subquery *tree.Subquery, b bool) (*plan.Expr, error)
- func (s *SetBinder) BindTimeWindowFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (s *SetBinder) BindWinFunc(_ string, expr *tree.FuncExpr, i int32, b bool) (*plan.Expr, error)
- func (b *SetBinder) GetContext() context.Context
- type Snapshot
- type SnapshotTenant
- type Stats
- type StatsCache
- type StatsInfoWrapper
- type SubscriptionMeta
- type TableBinder
- func (b *TableBinder) BindAggFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *TableBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *TableBinder) BindExpr(astExpr tree.Expr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *TableBinder) BindSubquery(astExpr *tree.Subquery, isRoot bool) (*plan.Expr, error)
- func (b *TableBinder) BindTimeWindowFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *TableBinder) BindWinFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *TableBinder) GetContext() context.Context
- type TableDef
- type TableDefType
- type TableDef_DefType_Properties
- type TableStatsInfo
- type Type
- type UnorderedSet
- type UpdateBinder
- func (b *UpdateBinder) BindAggFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *UpdateBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *UpdateBinder) BindExpr(astExpr tree.Expr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *UpdateBinder) BindSubquery(astExpr *tree.Subquery, isRoot bool) (*plan.Expr, error)
- func (b *UpdateBinder) BindTimeWindowFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *UpdateBinder) BindWinFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *UpdateBinder) GetContext() context.Context
- type ViewCfg
- type ViewData
- type ViewDef
- type VisitPlan
- type VisitPlanRule
- type WhereBinder
- func (b *WhereBinder) BindAggFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *WhereBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *WhereBinder) BindExpr(astExpr tree.Expr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *WhereBinder) BindSubquery(astExpr *tree.Subquery, isRoot bool) (*plan.Expr, error)
- func (b *WhereBinder) BindTimeWindowFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *WhereBinder) BindWinFunc(funcName string, astExpr *tree.FuncExpr, depth int32, isRoot bool) (*plan.Expr, error)
- func (b *WhereBinder) GetContext() context.Context
Constants ¶
const ( UnsupportedIndexCondition = 0 EqualIndexCondition = 1 NonEqualIndexCondition = 2 SpatialIndexCondition = 3 RangeIndexCondition = 4 // MaxOverFetchFactor is the maximum multiplier for over-fetching candidates // in auto mode vector search. This cap prevents excessive memory usage and // candidate processing when filter selectivity is very low (e.g., 0.001). // Value of 100 means we fetch at most 100x the original LIMIT value. MaxOverFetchFactor = 100.0 )
const ( TimeWindowStart = "_wstart" TimeWindowEnd = "_wend" )
const ( LoadParallelMinSize = int(colexec.WriteS3Threshold) LoadWriteS3MinSize = 1 << 20 )
const ( NotSampleByRows = -1 NotSampleByPercents = -1.0 )
const ( ParseJsonlFormatLine = "line" // treat each line as a single json value ParseJsonlFormatArray = "array" // each line is an array ParseJsonlFormatObject = "object" // each line is an object ParseJsonlTypeBool = "bool" ParseJsonlTypeInt32 = "int32" ParseJsonlTypeInt64 = "int64" ParseJsonlTypeTimestamp = "timestamp" ParseJsonlTypeFloat32 = "float32" ParseJsonlTypeFloat64 = "float64" ParseJsonlTypeString = "string" )
const ( InFilterCardLimitNonPK = 10000 InFilterCardLimitPK = 1000000 BloomFilterCardLimit = 100 * InFilterCardLimitNonPK InFilterSelectivityLimit = 0.3 )
const ( ShuffleThreshHoldOfNDV = 50000 ShuffleTypeThreshHoldLowerLimit = 16 ShuffleTypeThreshHoldUpperLimit = 1024 )
const ( ShuffleToRegIndex int32 = 0 ShuffleToLocalMatchedReg int32 = 1 ShuffleToMultiMatchedReg int32 = 2 )
const ( MoLocksColTypeCnId = iota //MoLocksColTypeSessionId MoLocksColTypeTxnId MoLocksColTypeTableId //MoLocksColTypeTableName MoLocksColTypeLockKey MoLocksColTypeLockContent MoLocksColTypeLockMode MoLocksColTypeLockStatus MoLocksColTypeLockWait )
const ( MoConfigColTypeNodeType = iota MoConfigColTypeNodeId MoConfigColTypeName MoConfigColTypeCurrentValue MoConfigColTypeDefaultValue MoConfigColTypeInternal )
const ( MoTransactionsColTypeCnId = iota MoTransactionsColTypeTxnId MoTransactionsColTypeCreateTs MoTransactionsColTypeSnapshotTs MoTransactionsColTypePreparedTs MoTransactionsColTypeCommitTs MoTransactionsColTypeTxnMode MoTransactionsColTypeIsolation MoTransactionsColTypeUserTxn MoTransactionsColTypeTxnStatus MoTransactionsColTypeTableId MoTransactionsColTypeLockKey MoTransactionsColTypeLockContent MoTransactionsColTypeLockMode )
const ( MoCacheColTypeNodeType = iota MoCacheColTypeNodeId MoCacheColTypeType MoCacheColTypeUsed MoCacheColTypeFree MoCacheColTypeHitRatio )
const ( JoinSideNone int8 = 0 JoinSideLeft = 1 << 1 JoinSideRight = 1 << 2 JoinSideBoth = JoinSideLeft | JoinSideRight JoinSideMark = 1 << 3 JoinSideOuter = 1 << 5 )
const ( // does not bind cte currently CteBindTypeNone = 0 // bind initial select stmt of recursive cte currently CteBindTypeInitStmt = 1 // bind recursive parts of recursive cte currently CteBindTypeRecurStmt = 2 // bind non recursive cte currently CteBindTypeNonRecur = 3 )
const BlockThresholdForOneCN = 512
const CSVCommentKey = "comment"
CSVCommentKey is the external-table option that sets the CSV reader's comment marker: a line whose raw prefix (before unquoting) equals it is skipped on read. The default (option absent or empty) is no marker — every line is data.
const ExternalWriteFilePatternKey = "write_file_pattern"
ExternalWriteFilePatternKey is the external-table option that turns the table into a writable external table. Its value is a strftime template (with the %nN and %U MatrixOne extensions) that must resolve to a stage:// path.
const INFORMATION_SCHEMA = "information_schema"
const LargeBlockThresholdForMultiCN = 32
const LargeBlockThresholdForOneCN = 4
const MO_CATALOG_DB_NAME = "mo_catalog"
const MO_DEFUALT_HOSTNAME = "localhost"
const (
// MaxFsp is the maximum digit of fractional seconds part.
MaxFsp = 6
)
const ( /* Identifier Length Limits See MySQL: https://dev.mysql.com/doc/refman/8.0/en/identifiers.html */ // MaxKeyParts is max length of key parts. MaxKeyParts = 16 )
const NameClusterCenters = "cluster_centers"
const NameGroupConcat = "group_concat"
const PKHostIdVirtualName = "__mo_pk_host_id"
PKHostIdVirtualName is the reserved identifier for predicates routed to the index's host_ids array (external primary keys) on the C++ side, instead of to a FilterStore column. Users must not create a table column with this name and then declare it as an INCLUDE column; the planner would redirect the predicate to host_ids and the FilterStore copy would be unused dead weight.
const (
// PrimaryKeyName defines primary key name.
PrimaryKeyName = "PRIMARY"
)
const RowSizeThreshold = 128
RowSizeThreshold Regardless of the table, the minimum row size is 100. However, due to inaccurate statistical information, the RowSizeThreshold is tentatively set at 128, and it is only used for tables with vector indexes
const SF float64 = 1
const SYSMOCATALOGPITR = "sys_mo_catalog_pitr"
const (
/*
https://dev.mysql.com/doc/refman/8.0/en/column-count-limit.html
MySQL has hard limit of 4096 columns per table, but the effective maximum may be less for a given table.
*/
TableColumnCountLimit = 4096
)
const UnKnownColId uint64 = math.MaxUint64
const ViewSnapshotKeySuffix = "@ts="
Variables ¶
var ( MetadataScanColDefs = []*plan.ColDef{} MetadataScanColTypes = []types.Type{} Metadata_Rows_Cnt_Pos int32 )
var ( TableStatsColDefs []*plan.ColDef TableStatsColTypes []types.Type )
var ForceAssignmentCastExpr = forceAssignmentCastExpr
var ForceCastExpr = forceCastExpr
var ForceScanOnMultiCN atomic.Bool
for test
var ID atomic.Int64
var MakePlan2BoolConstExprWithType = makePlan2BoolConstExprWithType
var MakePlan2DateConstExprWithType = makePlan2DateConstExprWithType
var MakePlan2DateTimeConstExprWithType = makePlan2DateTimeConstExprWithType
var MakePlan2Float32ConstExprWithType = makePlan2Float32ConstExprWithType
var MakePlan2Float64ConstExprWithType = makePlan2Float64ConstExprWithType
var MakePlan2Int16ConstExprWithType = makePlan2Int16ConstExprWithType
var MakePlan2Int32ConstExprWithType = makePlan2Int32ConstExprWithType
var MakePlan2Int64ConstExprWithType = makePlan2Int64ConstExprWithType
var MakePlan2Int64VecExprWithType = makePlan2Int64VecExprWithType
var MakePlan2Int8ConstExprWithType = makePlan2Int8ConstExprWithType
var MakePlan2StringConstExprWithType = makePlan2StringConstExprWithType
var MakePlan2StringVecExprWithType = makePlan2StringVecExprWithType
var MakePlan2TimeConstExprWithType = makePlan2TimeConstExprWithType
var MakePlan2TimestampConstExprWithType = makePlan2TimestampConstExprWithType
var MakePlan2Type = makePlan2Type
var MakePlan2TypeValue = makePlan2TypeValue
var MakePlan2Uint16ConstExprWithType = makePlan2Uint16ConstExprWithType
var MakePlan2Uint32ConstExprWithType = makePlan2Uint32ConstExprWithType
var MakePlan2Uint64ConstExprWithType = makePlan2Uint64ConstExprWithType
var MakePlan2Uint8ConstExprWithType = makePlan2Uint8ConstExprWithType
var MakePlan2Vecf32ConstExprWithType = makePlan2Vecf32ConstExprWithType
var MakePlan2Vecf64ConstExprWithType = makePlan2Vecf64ConstExprWithType
var MakeTypeByPlan2Expr = makeTypeByPlan2Expr
var MakeTypeByPlan2Type = makeTypeByPlan2Type
var ( MetaColDefs = []*plan.ColDef{ { Name: catalog.MetaColNames[catalog.QUERY_ID_IDX], Typ: plan.Type{ Id: int32(catalog.MetaColTypes[catalog.QUERY_ID_IDX].Oid), NotNullable: false, }, }, { Name: catalog.MetaColNames[catalog.STATEMENT_IDX], Typ: plan.Type{ Id: int32(catalog.MetaColTypes[catalog.STATEMENT_IDX].Oid), NotNullable: false, }, }, { Name: catalog.MetaColNames[catalog.ACCOUNT_ID_IDX], Typ: plan.Type{ Id: int32(catalog.MetaColTypes[catalog.ACCOUNT_ID_IDX].Oid), NotNullable: false, }, }, { Name: catalog.MetaColNames[catalog.ROLE_ID_IDX], Typ: plan.Type{ Id: int32(catalog.MetaColTypes[catalog.ROLE_ID_IDX].Oid), NotNullable: false, }, }, { Name: catalog.MetaColNames[catalog.RESULT_PATH_IDX], Typ: plan.Type{ Id: int32(catalog.MetaColTypes[catalog.RESULT_PATH_IDX].Oid), NotNullable: false, Width: 4, }, }, { Name: catalog.MetaColNames[catalog.CREATE_TIME_IDX], Typ: plan.Type{ Id: int32(catalog.MetaColTypes[catalog.CREATE_TIME_IDX].Oid), NotNullable: false, }, }, { Name: catalog.MetaColNames[catalog.RESULT_SIZE_IDX], Typ: plan.Type{ Id: int32(catalog.MetaColTypes[catalog.RESULT_SIZE_IDX].Oid), NotNullable: false, }, }, { Name: catalog.MetaColNames[catalog.TABLES_IDX], Typ: plan.Type{ Id: int32(catalog.MetaColTypes[catalog.TABLES_IDX].Oid), NotNullable: false, }, }, { Name: catalog.MetaColNames[catalog.USER_ID_IDX], Typ: plan.Type{ Id: int32(catalog.MetaColTypes[catalog.USER_ID_IDX].Oid), NotNullable: false, }, }, { Name: catalog.MetaColNames[catalog.EXPIRED_TIME_IDX], Typ: plan.Type{ Id: int32(catalog.MetaColTypes[catalog.EXPIRED_TIME_IDX].Oid), NotNullable: false, }, }, { Name: catalog.MetaColNames[catalog.COLUMN_MAP_IDX], Typ: plan.Type{ Id: int32(catalog.MetaColTypes[catalog.COLUMN_MAP_IDX].Oid), NotNullable: false, }, }, { Name: catalog.MetaColNames[catalog.SAVED_ROW_COUNT_IDX], Typ: plan.Type{ Id: int32(catalog.MetaColTypes[catalog.SAVED_ROW_COUNT_IDX].Oid), NotNullable: false, }, }, { Name: catalog.MetaColNames[catalog.QUERY_ROW_COUNT_IDX], Typ: plan.Type{ Id: int32(catalog.MetaColTypes[catalog.QUERY_ROW_COUNT_IDX].Oid), NotNullable: false, }, }, } )
var MoCacheColName2Index = map[string]int32{
"node_type": 0,
"node_id": 1,
"type": 2,
"used": 3,
"free": 4,
"hit_ratio": 5,
}
var MoCacheColNames = []string{
"node_type",
"node_id",
"type",
"used",
"free",
"hit_ratio",
}
var MoCacheColTypes = []types.Type{ types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_uint64, 0, 0), types.New(types.T_uint64, 0, 0), types.New(types.T_float32, 0, 0), }
var MoConfigColName2Index = map[string]int32{
"node_type": 0,
"node_id": 1,
"name": 2,
"current_value": 3,
"default_value": 4,
"internal": 5,
}
var MoConfigColNames = []string{
"node_type",
"node_id",
"name",
"current_value",
"default_value",
"internal",
}
var MoConfigColTypes = []types.Type{ types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), }
var MoLocksColName2Index = map[string]int32{
"cn_id": 0,
"txn_id": 1,
"table_id": 2,
"lock_key": 3,
"lock_content": 4,
"lock_mode": 5,
"lock_status": 6,
"lock_wait": 7,
}
var MoLocksColNames = []string{
"cn_id",
"txn_id",
"table_id",
"lock_key",
"lock_content",
"lock_mode",
"lock_status",
"lock_wait",
}
var MoLocksColTypes = []types.Type{ types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), }
var MoTransactionsColName2Index = map[string]int32{
"cn_id": 0,
"txn_id": 1,
"create_ts": 2,
"snapshot_ts": 3,
"prepared_ts": 4,
"commit_ts": 5,
"txn_mode": 6,
"isolation": 7,
"user_txn": 8,
"txn_status": 9,
"table_id": 10,
"lock_key": 11,
"lock_content": 12,
"lock_mode": 13,
}
var MoTransactionsColNames = []string{
"cn_id",
"txn_id",
"create_ts",
"snapshot_ts",
"prepared_ts",
"commit_ts",
"txn_mode",
"isolation",
"user_txn",
"txn_status",
"table_id",
"lock_key",
"lock_content",
"lock_mode",
}
var MoTransactionsColTypes = []types.Type{ types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), types.New(types.T_varchar, types.MaxVarcharLen, 0), }
var (
STATEMENT_ACCOUNT = "account"
)
var Sequence_cols_name = []string{"last_seq_num", "min_value", "max_value", "start_value", "increment_value", "cycle", "is_called"}
var SessionsColTypes []types.Type
Functions ¶
func AddColumn ¶ added in v1.0.0
func AddColumn( ctx CompilerContext, alterPlan *plan.AlterTable, spec *tree.AlterAddCol, alterCtx *AlterTableContext, ) (bool, error)
AddColumn will add a new column to the table.
func AddPrimaryKey ¶ added in v1.0.0
func AddPrimaryKey(ctx CompilerContext, alterPlan *plan.AlterTable, spec *tree.PrimaryKeyIndex, alterCtx *AlterTableContext) error
AddPrimaryKey will add a new column to the table.
func AlterColumn ¶ added in v1.0.0
func AlterColumn( ctx CompilerContext, alterPlan *plan.AlterTable, spec *tree.AlterTableAlterColumnClause, alterCtx *AlterTableContext, ) (bool, error)
AlterColumn ALTER ... SET DEFAULT or ALTER ... DROP DEFAULT specify a new default value for a column or remove the old default value, respectively. If the old default is removed and the column can be NULL, the new default is NULL. If the column cannot be NULL, MySQL assigns a default value
func AssignAuxIdForExpr ¶ added in v0.8.0
func BindFuncExprImplByPlanExpr ¶ added in v0.8.0
func BuildVectorsByData ¶ added in v0.7.0
func ByteSliceToUint64 ¶ added in v1.0.0
convert first 8 bytes to uint64, slice might be less than 8 bytes
func CalcRangeShuffleIDXForObj ¶
func CalcRangeShuffleIDXForObj(rsp *engine.RangesShuffleParam, objstats *objectio.ObjectStats, bucketNum int) uint64
func ChangeColumn ¶ added in v1.0.0
func ChangeColumn( cctx CompilerContext, alterPlan *plan.AlterTable, spec *tree.AlterTableChangeColumnClause, alterCtx *AlterTableContext, ) (bool, error)
ChangeColumn Can rename a column and change its definition, or both. Has more capability than MODIFY or RENAME COLUMN, but at the expense of convenience for some operations. CHANGE requires naming the column twice if not renaming it, and requires respecifying the column definition if only renaming it. With FIRST or AFTER, can reorder columns.
func ConstantFold ¶ added in v0.6.0
func ConstantTranspose ¶
func ConstructCreateTableSQL ¶ added in v1.2.1
func ConstructCreateTableSQL( ctx CompilerContext, tableDef *plan.TableDef, snapshot *Snapshot, useDbName bool, cloneStmt *tree.CloneTable, ) (string, tree.Statement, error)
ConstructCreateTableSQL used to build CREATE Table statement
func CreateIndexDef ¶ added in v1.1.0
func CreateIndexDef(ctx planplugin.CompilerContext, indexInfo *tree.Index, indexTableName, indexAlgoTableType string, indexParts []string, isUnique bool) (*plan.IndexDef, error)
func DbNameOfObjRef ¶
DbNameOfObjRef return subscription name of ObjectRef if exists, to avoid the mismatching of account id and db name
func DeepCopyAnalyzeInfo ¶ added in v0.7.0
func DeepCopyAnalyzeInfo(analyzeinfo *plan.AnalyzeInfo) *plan.AnalyzeInfo
func DeepCopyClusterTable ¶ added in v0.7.0
func DeepCopyClusterTable(cluster *plan.ClusterTable) *plan.ClusterTable
func DeepCopyDataDefinition ¶ added in v0.6.0
func DeepCopyDataDefinition(old *plan.DataDefinition) *plan.DataDefinition
func DeepCopyDedupJoinCtx ¶
func DeepCopyDedupJoinCtx(ctx *plan.DedupJoinCtx) *plan.DedupJoinCtx
func DeepCopyDeleteCtx ¶ added in v0.7.0
func DeepCopyGeneratedCol ¶
func DeepCopyGeneratedCol(old *plan.GeneratedCol) *plan.GeneratedCol
func DeepCopyIndexDef ¶ added in v0.7.0
func DeepCopyIndexOption ¶ added in v1.1.0
func DeepCopyIndexOption(indexOption *plan.IndexOption) *plan.IndexOption
func DeepCopyIndexReaderParam ¶
func DeepCopyIndexReaderParam(oldParam *plan.IndexReaderParam) *plan.IndexReaderParam
func DeepCopyInsertCtx ¶ added in v0.7.0
func DeepCopyLockTarget ¶ added in v0.8.0
func DeepCopyLockTarget(target *plan.LockTarget) *plan.LockTarget
func DeepCopyObjectRef ¶ added in v0.7.0
func DeepCopyOrderBySpec ¶
func DeepCopyOrderBySpec(orderBy *plan.OrderBySpec) *plan.OrderBySpec
func DeepCopyOrderBySpecList ¶
func DeepCopyOrderBySpecList(orderByList []*plan.OrderBySpec) []*plan.OrderBySpec
func DeepCopyPreInsertCtx ¶ added in v0.8.0
func DeepCopyPreInsertCtx(ctx *plan.PreInsertCtx) *plan.PreInsertCtx
func DeepCopyPreInsertUkCtx ¶ added in v0.8.0
func DeepCopyPreInsertUkCtx(ctx *plan.PreInsertUkCtx) *plan.PreInsertUkCtx
func DeepCopyPrimaryKeyDef ¶ added in v0.7.0
func DeepCopyPrimaryKeyDef(pkeyDef *plan.PrimaryKeyDef) *plan.PrimaryKeyDef
func DeepCopyRankOption ¶
func DeepCopyRankOption(opt *plan.RankOption) *plan.RankOption
func DeepCopyRuntimeFilterSpec ¶
func DeepCopyRuntimeFilterSpec(rf *plan.RuntimeFilterSpec) *plan.RuntimeFilterSpec
func DeepCopySampleFuncSpec ¶ added in v1.1.0
func DeepCopySampleFuncSpec(source *plan.SampleFuncSpec) *plan.SampleFuncSpec
func DeepCopyTableDef ¶ added in v0.6.0
func DeepCopyTableDefList ¶ added in v0.8.0
func DeepCopyUpdateCtxList ¶
func DefaultBigStats ¶
func DefaultHugeStats ¶ added in v0.8.0
func DefaultMinimalStats ¶ added in v1.1.0
func DefaultStats ¶ added in v0.7.0
func DefaultValueIsNull ¶ added in v1.0.0
func DropColumn ¶ added in v1.0.0
func DropColumn( ctx CompilerContext, alterPlan *plan.AlterTable, colName string, alterCtx *AlterTableContext, ) (bool, error)
AddColumn will add a new column to the table.
func DropPrimaryKey ¶ added in v1.0.0
func DropPrimaryKey(ctx CompilerContext, alterPlan *plan.AlterTable, alterCtx *AlterTableContext) error
func EscapeFormat ¶ added in v1.2.1
EscapeFormat output escape character with backslash.
func EvalFilterExpr ¶ added in v0.7.0
func EvalFoldExpr ¶
func ExprIsZonemappable ¶ added in v1.1.1
func ExtractToDateReturnType ¶ added in v0.8.0
func FormatColType ¶ added in v1.2.1
FormatColType Get the formatted description of the column type.
func FormatExpr ¶ added in v0.8.0
func FormatExpr(expr *plan.Expr, option FormatOption) string
func FormatExprInConsole ¶
func FormatExprInConsole(expr *plan.Expr, option FormatOption) string
func FormatExprs ¶ added in v1.2.0
func FormatExprs(exprs []*plan.Expr, option FormatOption) string
func FormatExprsInConsole ¶
func FormatExprsInConsole(exprs []*plan.Expr, option FormatOption) string
func FormatViewKeyWithSnapshot ¶
FormatViewKeyWithSnapshot appends snapshot information to a view key for privilege checks.
func GenConstraintName ¶ added in v1.1.2
func GenConstraintName() string
GenConstraintName yields uuid for the constraint name
func GetBindings ¶ added in v0.5.0
func GetCSVComment ¶
func GetCSVComment(param *tree.ExternParam) string
GetCSVComment returns the COMMENT option of an external table (empty when unset, meaning no comment marker).
func GetCenterValueForZMSigned ¶ added in v1.1.0
func GetCenterValueForZMUnsigned ¶ added in v1.1.0
func GetColumnMapByExpr ¶ added in v0.8.0
func GetColumnMapByExprs ¶ added in v0.8.0
func GetColumnsByExpr ¶ added in v0.7.0
func GetFilePathFromParam ¶
func GetFilePathFromParam(param *tree.ExternParam) string
func GetFkReferredTo ¶ added in v1.1.2
func GetFkReferredTo(ctx CompilerContext, db, table string) (map[FkReferKey]map[string][]*FkReferDef, error)
GetFkReferredTo returns the foreign key relationships that refer to the table
func GetForETLWithType ¶ added in v0.7.0
func GetForETLWithType(param *tree.ExternParam, prefix string) (res fileservice.ETLFileService, readPath string, err error)
func GetForceScanOnMultiCN ¶
func GetForceScanOnMultiCN() bool
func GetFunctionArgTypeStrFromAst ¶ added in v1.1.0
func GetFunctionArgTypeStrFromAst(arg tree.FunctionArg) (string, error)
GetFunctionArgTypeStrFromAst function arg type do not have scale and width, it depends on the data that it process
func GetFunctionTypeStrFromAst ¶ added in v1.1.0
func GetFunctionTypeStrFromAst(typRef tree.ResolvableTypeReference) (string, error)
func GetInFilterCardLimit ¶ added in v1.1.1
func GetInFilterCardLimitOnPK ¶ added in v1.2.0
func GetRangeShuffleIndexForZM ¶ added in v0.8.0
func GetRangeShuffleIndexForZMSignedSlice ¶ added in v1.1.0
func GetRangeShuffleIndexForZMUnsignedSlice ¶ added in v1.1.0
func GetRangeShuffleIndexSignedMinMax ¶ added in v1.1.0
func GetRangeShuffleIndexSignedSlice ¶ added in v1.1.0
func GetRangeShuffleIndexUnsignedMinMax ¶ added in v1.1.0
func GetRangeShuffleIndexUnsignedSlice ¶ added in v1.1.0
func GetRowSizeFromTableDef ¶ added in v1.2.0
func GetSortOrderByName ¶ added in v1.2.0
func GetSqlForFkReferredTo ¶ added in v1.1.2
GetSqlForFkReferredTo returns the query that retrieves the fk relationships that refer to the table
func GetUniqueColAndIdxFromTableDef ¶ added in v0.8.0
GetUniqueColAndIdxFromTableDef if get table: t1(a int primary key, b int, c int, d int, unique key(b,c)); return : []map[string]int { {'a'=1}, {'b'=2,'c'=3} }
func GetWriteFilePattern ¶
func GetWriteFilePattern(param *tree.ExternParam) (string, bool)
GetWriteFilePattern returns the WRITE_FILE_PATTERN option of an external table and whether it was set. An external table is writable iff this returns ok.
func HasFkSelfReferOnly ¶ added in v1.1.2
HasFkSelfReferOnly checks the foreign key referencing itself only. If there is no children tables, it also returns true the tbleId 0 is special. it always denotes the table itself.
func HasFoldExprForList ¶
func HasFoldValExpr ¶
func HasShuffleInPlan ¶
func IgnoredLines ¶
func IgnoredLines(param *tree.ExternParam, ctx CompilerContext) (offset int64, err error)
func InitInfileOrStageParam ¶
func InitInfileOrStageParam(param *tree.ExternParam, proc *process.Process) error
func InitInfileParam ¶ added in v0.7.0
func InitInfileParam(param *tree.ExternParam) error
func InitNullMap ¶ added in v0.6.0
func InitNullMap(param *tree.ExternParam, ctx CompilerContext) error
func InitS3Param ¶ added in v0.7.0
func InitS3Param(param *tree.ExternParam) error
func InitStageS3Param ¶
func InitStageS3Param(param *tree.ExternParam, s stage.StageDef) error
func InternalTable ¶ added in v1.2.0
func IsDefaultStats ¶
func IsEqualFunc ¶ added in v1.1.0
func IsEquiJoin2 ¶ added in v0.8.0
IsEquiJoin2 Judge whether a join node is equi-join (after column remapping) Can only be used after optimizer!!!
func IsFalseExpr ¶ added in v1.2.0
func IsFkBannedDatabase ¶ added in v1.1.2
IsFkBannedDatabase denotes the database should not have any foreign keys
func IsFkSelfRefer ¶ added in v1.1.2
IsFkSelfRefer checks the foreign key referencing itself
func IsForeignKeyChecksEnabled ¶ added in v1.1.2
func IsForeignKeyChecksEnabled(ctx CompilerContext) (bool, error)
IsForeignKeyChecksEnabled returns the system variable foreign_key_checks is true or false
func IsSnapshotValid ¶ added in v1.2.0
func MakeCPKEYRuntimeFilter ¶
func MakePlan2Decimal64ExprWithType ¶ added in v0.8.0
func MakePlan2Decimal128ExprWithType ¶ added in v0.8.0
func MakePlan2Decimal128ExprWithType(v types.Decimal128, typ *Type) *plan.Expr
func MakePlan2NullTextConstExprWithType ¶ added in v0.7.0
func MakeRuntimeFilter ¶ added in v1.2.0
func MakeSerialRuntimeFilter ¶
func ModifyColumn ¶ added in v1.0.0
func ModifyColumn( cctx CompilerContext, alterPlan *plan.AlterTable, spec *tree.AlterTableModifyColumnClause, alterCtx *AlterTableContext, ) (bool, error)
ModifyColumn Can change a column definition but not its name. More convenient than CHANGE to change a column definition without renaming it. With FIRST or AFTER, can reorder columns.
func NewShuffleRange ¶ added in v1.1.0
func NewShuffleRange(isString bool) *pb.ShuffleRange
func NewStatsInfo ¶ added in v1.2.0
func OrderByColumn ¶ added in v1.0.0
func OrderByColumn(ctx CompilerContext, alterPlan *plan.AlterTable, spec *tree.AlterTableOrderByColumnClause, alterCtx *AlterTableContext) error
OrderByColumn Currently, Mo only performs semantic checks on alter table order by and does not implement the function of changing the physical storage order of data in the table
func PrintStats ¶ added in v0.8.0
func ReCalcNodeStats ¶ added in v0.7.0
func ReCalcNodeStats(nodeID int32, builder *QueryBuilder, recursive bool, leafNode bool, needResetHashMapStats bool)
func ReadDir ¶ added in v0.7.0
func ReadDir(param *tree.ExternParam) (fileList []string, fileSize []int64, err error)
ReadDir support "etl:" and "/..." absolute path, NOT support relative path.
func RenameColumn ¶ added in v1.0.0
func RenameColumn( ctx CompilerContext, alterPlan *plan.AlterTable, spec *tree.AlterTableRenameColumnClause, alterCtx *AlterTableContext, ) error
RenameColumn Can change a column name but not its definition. More convenient than CHANGE to rename a column without changing its definition.
func ReplaceFoldExpr ¶
func ReplaceFoldExpr(proc *process.Process, expr *Expr, exes *[]colexec.ExpressionExecutor) (bool, error)
a > current_time() + 1 and b < ? + c and d > ? + 2 => a > foldVal1 and b < foldVal2 + c and d > foldVal3
func ResetAuxIdForExpr ¶ added in v0.8.0
func ResetPreparePlan ¶ added in v1.1.0
func ResolveAlterTableAlgorithm ¶ added in v1.0.0
func ResolveAlterTableAlgorithm( ctx context.Context, validAlterSpecs []tree.AlterTableOption, tableDef *TableDef, ) (algorithm plan.AlterTable_AlgorithmType, err error)
func RewriteCountNotNullColToStarcount ¶
RewriteCountNotNullColToStarcount rewrites count(not_null_col) to starcount (ObjName + Obj) on node.AggList so that compile uses countStarExec instead of countColumnExec. tableDef must be the child's (e.g. TABLE_SCAN).
func SetForceScanOnMultiCN ¶
func SetForceScanOnMultiCN(v bool)
func ShouldSkipObjByShuffle ¶
func ShouldSkipObjByShuffle(rsp *engine.RangesShuffleParam, objstats *objectio.ObjectStats) bool
func ShuffleRangeReEvalSigned ¶ added in v1.1.0
func ShuffleRangeReEvalUnsigned ¶ added in v1.1.0
func SimpleCharHashToRange ¶ added in v0.8.0
func SimpleInt64HashToRange ¶ added in v0.8.0
func StatFile ¶ added in v1.1.1
func StatFile(param *tree.ExternParam) error
func UpdateStatsInfo ¶ added in v1.2.0
func UpdateStatsInfo(info *TableStatsInfo, tableDef *plan.TableDef, s *pb.StatsInfo)
func VarlenaToUint64 ¶ added in v1.0.0
convert first 8 bytes to uint64
func VarlenaToUint64Inline ¶ added in v1.0.0
convert first 8 bytes to uint64. vec.area must be nil if varlena length less than 8 bytes, should have filled zero in varlena
Types ¶
type AlterTableContext ¶ added in v1.0.0
type AlterTableContext struct {
UpdateSqls []string
// contains filtered or unexported fields
}
type BaseOptimizer ¶ added in v0.5.0
type BaseOptimizer struct {
// contains filtered or unexported fields
}
BaseOptimizer is base optimizer, capable of handling only a few simple rules
func NewBaseOptimizer ¶ added in v0.5.0
func NewBaseOptimizer(ctx CompilerContext) *BaseOptimizer
func NewPrepareOptimizer ¶ added in v0.7.0
func NewPrepareOptimizer(ctx CompilerContext) *BaseOptimizer
func (*BaseOptimizer) CurrentContext ¶ added in v0.5.0
func (opt *BaseOptimizer) CurrentContext() CompilerContext
type BindContext ¶ added in v0.5.0
type BindContext struct {
// contains filtered or unexported fields
}
func NewBindContext ¶ added in v0.5.0
func NewBindContext(builder *QueryBuilder, parent *BindContext) *BindContext
type Binder ¶ added in v0.5.0
type Binder interface {
BindExpr(tree.Expr, int32, bool) (*plan.Expr, error)
BindColRef(*tree.UnresolvedName, int32, bool) (*plan.Expr, error)
BindAggFunc(string, *tree.FuncExpr, int32, bool) (*plan.Expr, error)
BindWinFunc(string, *tree.FuncExpr, int32, bool) (*plan.Expr, error)
BindSubquery(*tree.Subquery, bool) (*plan.Expr, error)
BindTimeWindowFunc(string, *tree.FuncExpr, int32, bool) (*plan.Expr, error)
GetContext() context.Context
}
type Binding ¶ added in v0.5.0
type Binding struct {
// contains filtered or unexported fields
}
func NewBinding ¶ added in v0.5.0
func (*Binding) FindColumn ¶ added in v0.5.0
type BindingTreeNode ¶ added in v0.5.0
type BindingTreeNode struct {
// contains filtered or unexported fields
}
type ClusterByDef ¶ added in v0.7.0
type ClusterByDef = plan.ClusterByDef
type ClusterTable ¶ added in v0.7.0
type ClusterTable = plan.ClusterTable
type ColDef ¶ added in v0.5.0
func FindColumn ¶ added in v0.8.0
FindColumn finds column in cols by name.
func FindColumnByColId ¶ added in v1.0.0
FindColumn finds column in cols by colId
func FindColumnByOriginName ¶
FindColumnByOriginName finds column in cols by origin name.
func GetColDefFromTable ¶ added in v1.0.0
GetColDefFromTable Find the target column definition from the predefined table columns and return its deep copy
func GetResultColumnsFromPlan ¶ added in v0.5.0
GetResultColumnsFromPlan
func MakeHiddenColDefByName ¶ added in v0.8.0
used for Compound primary key column name && clusterby column name
func MakeRowIdColDef ¶ added in v0.8.0
func MakeRowIdColDef() *ColDef
type ColRefRemapping ¶ added in v0.5.0
type ColRefRemapping struct {
// contains filtered or unexported fields
}
func (*ColRefRemapping) String ¶ added in v1.2.2
func (m *ColRefRemapping) String() string
type CompilerContext ¶ added in v0.5.0
type CompilerContext interface {
// Default database/schema in context
DefaultDatabase() string
// check if database exist
DatabaseExists(name string, snapshot *Snapshot) bool
// get table definition by database/schema
Resolve(schemaName string, tableName string, snapshot *Snapshot) (*ObjectRef, *TableDef, error)
// get index table definition by an ObjectRef, will skip unnecessary subscription check
ResolveIndexTableByRef(ref *ObjectRef, tblName string, snapshot *Snapshot) (*ObjectRef, *TableDef, error)
// get table definition by table id
ResolveById(tableId uint64, snapshot *Snapshot) (*ObjectRef, *TableDef, error)
// get the value of variable
ResolveVariable(varName string, isSystemVar, isGlobalVar bool) (interface{}, error)
// get the list of the account id
ResolveAccountIds(accountNames []string) ([]uint32, error)
// get the relevant information of udf
ResolveUdf(name string, args []*Expr) (*function.Udf, error)
// get needed info for stats by table, NOTE: Stats May indirectly access the file service
Stats(obj *ObjectRef, snapshot *Snapshot) (*pb.StatsInfo, error)
// get origin sql string of the root
GetRootSql() string
// get username of current session
GetUserName() string
GetAccountId() (uint32, error)
GetAccountName() string
// GetContext get raw context.Context
GetContext() context.Context
// SetContext set raw context.Context
SetContext(ctx context.Context)
// GetDatabaseId Get database id
GetDatabaseId(dbName string, snapshot *Snapshot) (uint64, error)
GetProcess() *process.Process
GetQueryResultMeta(uuid string) ([]*ColDef, string, error)
SetBuildingAlterView(yesOrNo bool, dbName, viewName string)
// is building the alter view or not
// return: yes or no, dbName, viewName
GetBuildingAlterView() (bool, string, string)
GetStatsCache() *StatsCache
GetSubscriptionMeta(dbName string, snapshot *Snapshot) (*SubscriptionMeta, error)
CheckSubscriptionValid(subName, accName string, pubName string) error
SetQueryingSubscription(meta *SubscriptionMeta)
GetQueryingSubscription() *SubscriptionMeta
IsPublishing(dbName string) (bool, error)
BuildTableDefByMoColumns(dbName, table string) (*TableDef, error)
ResolveSubscriptionTableById(tableId uint64, pubmeta *SubscriptionMeta) (*ObjectRef, *TableDef, error)
ResolveSnapshotWithSnapshotName(snapshotName string) (*Snapshot, error)
CheckTimeStampValid(ts int64) (bool, error)
//InitExecuteStmtParam replaces the plan of the EXECUTE by the plan generated by the PREPARE.
//return
// the plan generated by the PREPARE
// the statement generated by the PREPARE
InitExecuteStmtParam(execPlan *plan.Execute) (*plan.Plan, tree.Statement, error)
GetSnapshot() *Snapshot
SetSnapshot(snapshot *Snapshot)
GetViews() []string
SetViews(views []string)
GetLowerCaseTableNames() int64
}
type CteBindState ¶
type CteBindState struct {
// contains filtered or unexported fields
}
type DMLContext ¶
type DMLContext struct {
// contains filtered or unexported fields
}
func NewDMLContext ¶
func NewDMLContext() *DMLContext
func (*DMLContext) ResolveSingleTable ¶
func (dmlCtx *DMLContext) ResolveSingleTable(ctx CompilerContext, tbl tree.TableExpr, aliasMap map[string][2]string, withMap map[string]bool, respectFKCheck bool) error
func (*DMLContext) ResolveTables ¶
func (dmlCtx *DMLContext) ResolveTables(ctx CompilerContext, tableExprs tree.TableExprs, with *tree.With, aliasMap map[string][2]string, respectFKCheck bool) error
func (*DMLContext) ResolveUpdateTables ¶
func (dmlCtx *DMLContext) ResolveUpdateTables(ctx CompilerContext, stmt *tree.Update) error
type DefaultBinder ¶ added in v0.6.0
type DefaultBinder struct {
// contains filtered or unexported fields
}
func NewDefaultBinder ¶ added in v0.6.0
func NewDefaultBinder(sysCtx context.Context, builder *QueryBuilder, ctx *BindContext, typ Type, cols []string) *DefaultBinder
func (*DefaultBinder) BindAggFunc ¶ added in v0.6.0
func (*DefaultBinder) BindColRef ¶ added in v0.6.0
func (b *DefaultBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
func (*DefaultBinder) BindSubquery ¶ added in v0.6.0
func (*DefaultBinder) BindTimeWindowFunc ¶ added in v1.1.0
func (*DefaultBinder) BindWinFunc ¶ added in v0.6.0
func (*DefaultBinder) GetContext ¶ added in v0.7.0
type ExpandAliasMode ¶ added in v1.0.0
type ExpandAliasMode int8
const ( NoAlias ExpandAliasMode = iota AliasBeforeColumn AliasAfterColumn )
type Expr ¶ added in v0.5.0
func DeepCopyExpr ¶ added in v0.5.0
func DeepCopyExprList ¶ added in v0.6.0
func GenUniqueColCheckExpr ¶ added in v0.8.0
func GenUniqueColCheckExpr(ctx context.Context, tableDef *TableDef, uniqueCols []map[string]int, colCount int) ([]*Expr, error)
GenUniqueColCheckExpr like GenUniqueColJoinExpr. but use for on duplicate key clause to check conflict if get table: t1(a int primary key, b int, c int, d int, unique key(b,c)); we get batch like [1,2,3,4, origin_a, origin_b, origin_c, origin_d, row_id ....]。 we get expr like: []*Expr{ 1=origin_a , (2 = origin_b and 3 = origin_c) }
func GenUniqueColJoinExpr ¶ added in v0.8.0
func GenUniqueColJoinExpr(ctx context.Context, tableDef *TableDef, uniqueCols []map[string]int, leftTag int32, rightTag int32) (*Expr, error)
GenUniqueColJoinExpr if get table: t1(a int primary key, b int, c int, d int, unique key(b,c)); uniqueCols is: []map[string]int { {'a'=1}, {'b'=2,'c'=3} } we will get expr like: 'leftTag.a = rightTag.a or (leftTag.b = rightTag.b and leftTag.c = rightTag. c)
func MakeFalseExpr ¶ added in v1.2.0
func MakeFalseExpr() *Expr
func MakeInExpr ¶ added in v1.2.0
func MakeIntervalExpr ¶ added in v1.2.0
type ExternAttr ¶
type ExternAttr = plan.ExternAttr
type FkData ¶ added in v1.1.2
type FkData struct {
// fk reference to itself
IsSelfRefer bool
// the database that the fk refers to
ParentDbName string
// the table that the fk refers to
ParentTableName string
// the columns in foreign key
Cols *plan.FkColName
// the columns referred
ColsReferred *plan.FkColName
// fk definition
Def *plan.ForeignKeyDef
// the column typs in foreign key
ColTyps map[int]*plan.Type
// update foreign keys relations
UpdateSql string
// forward reference
ForwardRefer bool
}
type FkReferDef ¶ added in v1.1.2
type FkReferDef struct {
Db string //fk database name
Tbl string //fk table name
Name string //fk constraint name
Col string //fk column name, letter case: lower
ReferCol string //referenced column name, letter case: lower
OnDelete string //on delete action
OnUpdate string //on update action
}
FkReferDef holds the definition & details of the foreign key
func (FkReferDef) String ¶ added in v1.1.2
func (fk FkReferDef) String() string
type FkReferKey ¶ added in v1.1.2
FkReferKey holds the database and table name of the foreign key
type ForeignKeyDef ¶ added in v0.7.0
type ForeignKeyDef = plan.ForeignKeyDef
func DeepCopyFkey ¶ added in v0.8.0
func DeepCopyFkey(fkey *ForeignKeyDef) *ForeignKeyDef
type FormatOption ¶
type GeneratedColBinder ¶
type GeneratedColBinder struct {
// contains filtered or unexported fields
}
GeneratedColBinder binds expressions for generated columns. Unlike DefaultBinder, it resolves each column reference with the column's own type instead of a single shared type.
func NewGeneratedColBinder ¶
func (*GeneratedColBinder) BindAggFunc ¶
func (*GeneratedColBinder) BindColRef ¶
func (b *GeneratedColBinder) BindColRef(astExpr *tree.UnresolvedName, _ int32, _ bool) (*plan.Expr, error)
func (*GeneratedColBinder) BindSubquery ¶
func (*GeneratedColBinder) BindTimeWindowFunc ¶
func (*GeneratedColBinder) BindWinFunc ¶
func (*GeneratedColBinder) GetContext ¶
type GetParamRule ¶ added in v0.6.0
type GetParamRule struct {
// contains filtered or unexported fields
}
func NewGetParamRule ¶ added in v0.5.1
func NewGetParamRule() *GetParamRule
func (*GetParamRule) ApplyNode ¶ added in v0.6.0
func (rule *GetParamRule) ApplyNode(node *Node) error
func (*GetParamRule) IsApplyExpr ¶ added in v0.6.0
func (rule *GetParamRule) IsApplyExpr() bool
func (*GetParamRule) MatchNode ¶ added in v0.6.0
func (rule *GetParamRule) MatchNode(node *Node) bool
func (*GetParamRule) SetParamOrder ¶ added in v0.6.0
func (rule *GetParamRule) SetParamOrder()
type GroupBinder ¶ added in v0.5.0
type GroupBinder struct {
// contains filtered or unexported fields
}
func NewGroupBinder ¶ added in v0.5.0
func NewGroupBinder(builder *QueryBuilder, ctx *BindContext, selectList tree.SelectExprs) *GroupBinder
func (*GroupBinder) BindAggFunc ¶ added in v0.5.0
func (*GroupBinder) BindColRef ¶ added in v0.5.0
func (b *GroupBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
func (*GroupBinder) BindSubquery ¶ added in v0.5.0
func (*GroupBinder) BindTimeWindowFunc ¶ added in v1.1.0
func (*GroupBinder) BindWinFunc ¶ added in v0.5.0
func (*GroupBinder) GetContext ¶ added in v0.7.0
type HavingBinder ¶ added in v0.5.0
type HavingBinder struct {
// contains filtered or unexported fields
}
func NewHavingBinder ¶ added in v0.5.0
func NewHavingBinder(builder *QueryBuilder, ctx *BindContext) *HavingBinder
func (*HavingBinder) BindAggFunc ¶ added in v0.5.0
func (*HavingBinder) BindColRef ¶ added in v0.5.0
func (b *HavingBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
func (*HavingBinder) BindSubquery ¶ added in v0.5.0
func (*HavingBinder) BindTimeWindowFunc ¶ added in v1.1.0
func (*HavingBinder) BindWinFunc ¶ added in v0.5.0
func (*HavingBinder) GetContext ¶ added in v0.7.0
type LimitBinder ¶ added in v0.5.0
type LimitBinder struct {
// contains filtered or unexported fields
}
func NewLimitBinder ¶ added in v0.5.0
func NewLimitBinder(builder *QueryBuilder, ctx *BindContext, isOffset bool) *LimitBinder
func (*LimitBinder) BindAggFunc ¶ added in v0.5.0
func (*LimitBinder) BindColRef ¶ added in v0.5.0
func (b *LimitBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
func (*LimitBinder) BindSubquery ¶ added in v0.5.0
func (*LimitBinder) BindTimeWindowFunc ¶ added in v1.1.0
func (*LimitBinder) BindWinFunc ¶ added in v0.5.0
func (*LimitBinder) GetContext ¶ added in v0.7.0
type MoCacheColType ¶ added in v1.1.0
type MoCacheColType int32
type MoConfigColType ¶ added in v1.1.0
type MoConfigColType int32
type MoLocksColType ¶ added in v1.1.0
type MoLocksColType int32
type MoTransactionsColType ¶ added in v1.1.0
type MoTransactionsColType int32
type MockCompilerContext ¶ added in v0.5.0
type MockCompilerContext struct {
// Add function fields for test overrides
GetAccountNameFunc func() string
GetAccountIdFunc func() (uint32, error)
DatabaseExistsFunc func(string, *Snapshot) bool
GetDatabaseIdFunc func(string, *Snapshot) (uint64, error)
ResolveAccountIdsFunc func([]string) ([]uint32, error)
ResolveFunc func(string, string, *Snapshot) (*ObjectRef, *TableDef)
// contains filtered or unexported fields
}
func NewEmptyCompilerContext ¶ added in v0.5.0
func NewEmptyCompilerContext() *MockCompilerContext
NewEmptyCompilerContext for test create/drop statement
func NewMockCompilerContext ¶ added in v0.5.0
func NewMockCompilerContext(isDml bool) *MockCompilerContext
func (*MockCompilerContext) BuildTableDefByMoColumns ¶
func (m *MockCompilerContext) BuildTableDefByMoColumns(dbName, table string) (*TableDef, error)
func (*MockCompilerContext) CheckSubscriptionValid ¶ added in v0.8.0
func (m *MockCompilerContext) CheckSubscriptionValid(subName, accName string, pubName string) error
func (*MockCompilerContext) CheckTimeStampValid ¶ added in v1.2.0
func (m *MockCompilerContext) CheckTimeStampValid(ts int64) (bool, error)
func (*MockCompilerContext) DatabaseExists ¶ added in v0.5.0
func (m *MockCompilerContext) DatabaseExists(name string, snapshot *Snapshot) bool
func (*MockCompilerContext) DefaultDatabase ¶ added in v0.5.0
func (m *MockCompilerContext) DefaultDatabase() string
func (*MockCompilerContext) GetAccountId ¶ added in v0.6.0
func (m *MockCompilerContext) GetAccountId() (uint32, error)
func (*MockCompilerContext) GetAccountName ¶
func (m *MockCompilerContext) GetAccountName() string
func (*MockCompilerContext) GetBuildingAlterView ¶ added in v0.7.0
func (m *MockCompilerContext) GetBuildingAlterView() (bool, string, string)
func (*MockCompilerContext) GetContext ¶ added in v0.7.0
func (m *MockCompilerContext) GetContext() context.Context
func (*MockCompilerContext) GetDatabaseId ¶ added in v0.8.0
func (m *MockCompilerContext) GetDatabaseId(dbName string, snapshot *Snapshot) (uint64, error)
func (*MockCompilerContext) GetLowerCaseTableNames ¶ added in v1.2.1
func (m *MockCompilerContext) GetLowerCaseTableNames() int64
func (*MockCompilerContext) GetProcess ¶ added in v0.7.0
func (m *MockCompilerContext) GetProcess() *process.Process
func (*MockCompilerContext) GetQueryResultMeta ¶ added in v0.7.0
func (m *MockCompilerContext) GetQueryResultMeta(uuid string) ([]*ColDef, string, error)
func (*MockCompilerContext) GetQueryingSubscription ¶ added in v0.8.0
func (m *MockCompilerContext) GetQueryingSubscription() *SubscriptionMeta
func (*MockCompilerContext) GetRootSql ¶ added in v0.6.0
func (m *MockCompilerContext) GetRootSql() string
func (*MockCompilerContext) GetSnapshot ¶ added in v1.2.0
func (m *MockCompilerContext) GetSnapshot() *Snapshot
func (*MockCompilerContext) GetStatsCache ¶ added in v0.8.0
func (m *MockCompilerContext) GetStatsCache() *StatsCache
func (*MockCompilerContext) GetSubscriptionMeta ¶ added in v0.8.0
func (m *MockCompilerContext) GetSubscriptionMeta(dbName string, snapshot *Snapshot) (*SubscriptionMeta, error)
func (*MockCompilerContext) GetUserName ¶ added in v0.6.0
func (m *MockCompilerContext) GetUserName() string
func (*MockCompilerContext) GetViews ¶ added in v1.2.0
func (m *MockCompilerContext) GetViews() []string
func (*MockCompilerContext) InitExecuteStmtParam ¶
func (*MockCompilerContext) IsPublishing ¶ added in v0.8.0
func (m *MockCompilerContext) IsPublishing(dbName string) (bool, error)
func (*MockCompilerContext) ResolveAccountIds ¶ added in v0.7.0
func (m *MockCompilerContext) ResolveAccountIds(accountNames []string) ([]uint32, error)
func (*MockCompilerContext) ResolveById ¶ added in v0.7.0
func (*MockCompilerContext) ResolveIndexTableByRef ¶
func (*MockCompilerContext) ResolveSnapshotWithSnapshotName ¶ added in v1.2.0
func (m *MockCompilerContext) ResolveSnapshotWithSnapshotName(snapshotName string) (*Snapshot, error)
func (*MockCompilerContext) ResolveSubscriptionTableById ¶ added in v1.2.0
func (m *MockCompilerContext) ResolveSubscriptionTableById(tableId uint64, pubmeta *SubscriptionMeta) (*ObjectRef, *TableDef, error)
func (*MockCompilerContext) ResolveUdf ¶ added in v0.8.0
func (*MockCompilerContext) ResolveVariable ¶ added in v0.5.0
func (m *MockCompilerContext) ResolveVariable(varName string, isSystemVar, isGlobalVar bool) (interface{}, error)
func (*MockCompilerContext) SetBuildingAlterView ¶ added in v0.7.0
func (m *MockCompilerContext) SetBuildingAlterView(yesOrNo bool, dbName, viewName string)
func (*MockCompilerContext) SetContext ¶
func (m *MockCompilerContext) SetContext(ctx context.Context)
func (*MockCompilerContext) SetQueryingSubscription ¶ added in v0.8.0
func (m *MockCompilerContext) SetQueryingSubscription(*SubscriptionMeta)
func (*MockCompilerContext) SetSnapshot ¶ added in v1.2.0
func (m *MockCompilerContext) SetSnapshot(snapshot *Snapshot)
func (*MockCompilerContext) SetViews ¶ added in v1.2.0
func (m *MockCompilerContext) SetViews(views []string)
type MockOptimizer ¶ added in v0.5.0
type MockOptimizer struct {
// contains filtered or unexported fields
}
func NewEmptyMockOptimizer ¶ added in v0.5.0
func NewEmptyMockOptimizer() *MockOptimizer
func NewMockOptimizer ¶ added in v0.5.0
func NewMockOptimizer(_ bool) *MockOptimizer
func (*MockOptimizer) CurrentContext ¶ added in v0.5.0
func (moc *MockOptimizer) CurrentContext() CompilerContext
type MultiTableIndex ¶ added in v1.1.0
type NameTuple ¶ added in v0.5.0
type NameTuple struct {
// contains filtered or unexported fields
}
type OndupUpdateBinder ¶
type OndupUpdateBinder struct {
// contains filtered or unexported fields
}
func NewOndupUpdateBinder ¶
func NewOndupUpdateBinder(sysCtx context.Context, builder *QueryBuilder, ctx *BindContext, scanTag, selectTag int32, tableDef *plan.TableDef) *OndupUpdateBinder
use for on duplicate key update clause: eg: insert into t1 values(1,1),(2,2) on duplicate key update a = a + abs(b), b = values(b)-2
func (*OndupUpdateBinder) BindAggFunc ¶
func (*OndupUpdateBinder) BindColRef ¶
func (b *OndupUpdateBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
func (*OndupUpdateBinder) BindSubquery ¶
func (*OndupUpdateBinder) BindTimeWindowFunc ¶
func (*OndupUpdateBinder) BindWinFunc ¶
func (*OndupUpdateBinder) GetContext ¶
type Optimizer ¶ added in v0.5.0
type Optimizer interface {
Optimize(stmt tree.Statement) (*Query, error)
CurrentContext() CompilerContext
}
type OptimizerHints ¶ added in v1.2.0
type OptimizerHints struct {
// contains filtered or unexported fields
}
type OrderBinder ¶ added in v0.5.0
type OrderBinder struct {
*ProjectionBinder
// contains filtered or unexported fields
}
func NewOrderBinder ¶ added in v0.5.0
func NewOrderBinder(projectionBinder *ProjectionBinder, selectList tree.SelectExprs) *OrderBinder
func (OrderBinder) GetContext ¶ added in v0.7.0
type OrderBySpec ¶ added in v0.6.0
type OrderBySpec = plan.OrderBySpec
type OriginTableMessageForFuzzy ¶ added in v1.1.0
fuzzy filter need to get partial unique key attrs name and its origin table name for Decimal type, we need colDef to get the scale
type ParseJsonlOptions ¶
type ParseJsonlOptions struct {
Format string `json:"format"`
Cols []ParseJsonlOptionsCol `json:"cols"`
}
type ParseJsonlOptionsCol ¶
type PartitionBinder ¶ added in v0.6.0
type PartitionBinder struct {
// contains filtered or unexported fields
}
func NewPartitionBinder ¶ added in v0.6.0
func NewPartitionBinder(builder *QueryBuilder, ctx *BindContext) *PartitionBinder
func (*PartitionBinder) BindAggFunc ¶ added in v0.6.0
func (*PartitionBinder) BindColRef ¶ added in v0.6.0
func (p *PartitionBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
func (*PartitionBinder) BindSubquery ¶ added in v0.6.0
func (*PartitionBinder) BindTimeWindowFunc ¶ added in v1.1.0
func (*PartitionBinder) BindWinFunc ¶ added in v0.6.0
func (*PartitionBinder) GetContext ¶ added in v0.7.0
type Plan_Query ¶ added in v0.5.0
type Plan_Query = plan.Plan_Query
type PrimaryKeyDef ¶ added in v0.7.0
type PrimaryKeyDef = plan.PrimaryKeyDef
type ProjectionBinder ¶ added in v0.5.0
type ProjectionBinder struct {
// contains filtered or unexported fields
}
func NewProjectionBinder ¶ added in v0.5.0
func NewProjectionBinder(builder *QueryBuilder, ctx *BindContext, havingBinder *HavingBinder) *ProjectionBinder
func (*ProjectionBinder) BindAggFunc ¶ added in v0.5.0
func (*ProjectionBinder) BindColRef ¶ added in v0.5.0
func (b *ProjectionBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
func (*ProjectionBinder) BindSubquery ¶ added in v0.5.0
func (*ProjectionBinder) BindTimeWindowFunc ¶ added in v1.1.0
func (*ProjectionBinder) BindWinFunc ¶ added in v0.5.0
func (*ProjectionBinder) GetContext ¶ added in v0.7.0
type PropertiesDef ¶ added in v0.6.0
type PropertiesDef = plan.PropertiesDef
type QueryBuilder ¶ added in v0.5.0
type QueryBuilder struct {
// contains filtered or unexported fields
}
func NewQueryBuilder ¶ added in v0.5.0
func NewQueryBuilder(queryType plan.Query_StatementType, ctx CompilerContext, isPrepareStatement bool, skipStats bool) *QueryBuilder
func (*QueryBuilder) AppendNode ¶
func (builder *QueryBuilder) AppendNode(node *plan.Node, ctx planplugin.BindContext) int32
func (*QueryBuilder) ApplyIndicesForSortUsingCagra ¶
func (builder *QueryBuilder) ApplyIndicesForSortUsingCagra(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef, nodeID int32, _ planplugin.ApplyForSortOpts) (int32, bool, error)
func (*QueryBuilder) ApplyIndicesForSortUsingHnsw ¶
func (builder *QueryBuilder) ApplyIndicesForSortUsingHnsw(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef, nodeID int32, _ planplugin.ApplyForSortOpts) (int32, bool, error)
func (*QueryBuilder) ApplyIndicesForSortUsingIvfflat ¶
func (builder *QueryBuilder) ApplyIndicesForSortUsingIvfflat(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef, nodeID int32, opts planplugin.ApplyForSortOpts) (int32, bool, error)
func (*QueryBuilder) ApplyIndicesForSortUsingIvfpq ¶
func (builder *QueryBuilder) ApplyIndicesForSortUsingIvfpq(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef, nodeID int32, _ planplugin.ApplyForSortOpts) (int32, bool, error)
func (*QueryBuilder) CanApplyCagra ¶
func (builder *QueryBuilder) CanApplyCagra(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef) (bool, error)
func (*QueryBuilder) CanApplyHnsw ¶
func (builder *QueryBuilder) CanApplyHnsw(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef) (bool, error)
func (*QueryBuilder) CanApplyIvfflat ¶
func (builder *QueryBuilder) CanApplyIvfflat(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef) (bool, error)
func (*QueryBuilder) CanApplyIvfpq ¶
func (builder *QueryBuilder) CanApplyIvfpq(vctx *planplugin.VectorSortContext, mti *planplugin.MultiTableIndexRef) (bool, error)
func (*QueryBuilder) GenNewBindTag ¶
func (builder *QueryBuilder) GenNewBindTag() int32
func (*QueryBuilder) GetContext ¶ added in v0.7.0
func (builder *QueryBuilder) GetContext() context.Context
func (*QueryBuilder) IsEquiJoin ¶ added in v0.8.0
func (builder *QueryBuilder) IsEquiJoin(node *plan.Node) bool
func (*QueryBuilder) ResolveTsHint ¶
func (builder *QueryBuilder) ResolveTsHint(tsExpr *tree.AtTimeStamp) (snapshot *Snapshot, err error)
type RemapInfo ¶ added in v1.2.2
type RemapInfo struct {
// contains filtered or unexported fields
}
type ResetParamOrderRule ¶ added in v0.6.0
type ResetParamOrderRule struct {
// contains filtered or unexported fields
}
func NewResetParamOrderRule ¶ added in v0.6.0
func NewResetParamOrderRule(params map[int]int) *ResetParamOrderRule
func (*ResetParamOrderRule) ApplyNode ¶ added in v0.6.0
func (rule *ResetParamOrderRule) ApplyNode(node *Node) error
func (*ResetParamOrderRule) IsApplyExpr ¶ added in v0.6.0
func (rule *ResetParamOrderRule) IsApplyExpr() bool
func (*ResetParamOrderRule) MatchNode ¶ added in v0.6.0
func (rule *ResetParamOrderRule) MatchNode(_ *Node) bool
type ResetParamRefRule ¶ added in v0.6.0
type ResetParamRefRule struct {
// contains filtered or unexported fields
}
func NewResetParamRefRule ¶ added in v0.6.0
func NewResetParamRefRule(ctx context.Context, params []*Expr) *ResetParamRefRule
func (*ResetParamRefRule) ApplyNode ¶ added in v0.6.0
func (rule *ResetParamRefRule) ApplyNode(node *Node) error
func (*ResetParamRefRule) IsApplyExpr ¶ added in v0.6.0
func (rule *ResetParamRefRule) IsApplyExpr() bool
func (*ResetParamRefRule) MatchNode ¶ added in v0.6.0
func (rule *ResetParamRefRule) MatchNode(_ *Node) bool
type RowsetData ¶ added in v0.5.0
type RowsetData = plan.RowsetData
type SampleFuncCtx ¶ added in v1.1.0
type SampleFuncCtx struct {
// contains filtered or unexported fields
}
func (*SampleFuncCtx) BindSampleColumn ¶ added in v1.1.0
func (s *SampleFuncCtx) BindSampleColumn(ctx *BindContext, binder *ProjectionBinder, sampleList tree.SelectExprs) ([]*plan.Expr, error)
func (*SampleFuncCtx) GenerateSampleFunc ¶ added in v1.1.0
func (s *SampleFuncCtx) GenerateSampleFunc(se *tree.SampleExpr) error
func (*SampleFuncCtx) SetStartOffset ¶ added in v1.1.0
func (s *SampleFuncCtx) SetStartOffset(start, offset int)
type SelectField ¶
type SelectField struct {
// contains filtered or unexported fields
}
type SetBinder ¶ added in v0.8.0
type SetBinder struct {
// contains filtered or unexported fields
}
SetBinder for 'set @var = expr'
func NewSetVarBinder ¶ added in v0.8.0
func NewSetVarBinder(builder *QueryBuilder, ctx *BindContext) *SetBinder
func (*SetBinder) BindAggFunc ¶ added in v0.8.0
func (*SetBinder) BindColRef ¶ added in v0.8.0
func (*SetBinder) BindSubquery ¶ added in v0.8.0
func (*SetBinder) BindTimeWindowFunc ¶ added in v1.1.0
func (*SetBinder) BindWinFunc ¶ added in v0.8.0
func (*SetBinder) GetContext ¶ added in v0.8.0
type SnapshotTenant ¶ added in v1.2.0
type SnapshotTenant = plan.SnapshotTenant
type StatsCache ¶ added in v0.8.0
type StatsCache struct {
// contains filtered or unexported fields
}
func NewStatsCache ¶ added in v0.8.0
func NewStatsCache() *StatsCache
func (*StatsCache) Get ¶
func (sc *StatsCache) Get(tableID uint64) StatsInfoWrapper
Get returns the cached wrapper for the table. Use wrapper.Exists() to check if it was actually cached.
type StatsInfoWrapper ¶
type StatsInfoWrapper struct {
// contains filtered or unexported fields
}
The StatsInfoWrapper caches the stats query result for a table.
func (*StatsInfoWrapper) Exists ¶
func (w *StatsInfoWrapper) Exists() bool
Exists returns true if the wrapper has been set (lastVisit > 0).
func (*StatsInfoWrapper) GetLastVisit ¶
func (w *StatsInfoWrapper) GetLastVisit() int64
GetLastVisit returns the last visit time (unix seconds).
func (*StatsInfoWrapper) GetStats ¶
func (w *StatsInfoWrapper) GetStats() *pb.StatsInfo
GetStats returns the cached stats.
type SubscriptionMeta ¶ added in v0.8.0
type SubscriptionMeta = plan.SubscriptionMeta
type TableBinder ¶ added in v0.5.0
type TableBinder struct {
// contains filtered or unexported fields
}
func NewTableBinder ¶ added in v0.5.0
func NewTableBinder(builder *QueryBuilder, ctx *BindContext) *TableBinder
func (*TableBinder) BindAggFunc ¶ added in v0.5.0
func (*TableBinder) BindColRef ¶ added in v0.5.0
func (b *TableBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
func (*TableBinder) BindSubquery ¶ added in v0.5.0
func (*TableBinder) BindTimeWindowFunc ¶ added in v1.1.0
func (*TableBinder) BindWinFunc ¶ added in v0.5.0
func (*TableBinder) GetContext ¶ added in v0.7.0
type TableDefType ¶ added in v0.6.0
type TableDefType = plan.TableDef_DefType
type TableDef_DefType_Properties ¶ added in v0.6.0
type TableDef_DefType_Properties = plan.TableDef_DefType_Properties
type TableStatsInfo ¶
type TableStatsInfo struct {
ColumnZMs []objectio.ZoneMap
DataTypes []types.Type
ColumnNDVs []float64
MaxNDVs []float64
NDVinMaxObject []float64 // NDV in the object with maximum row count, per column
NDVinMinObject []float64 // NDV in the object with minimum row count, per column
NullCnts []int64
ShuffleRanges []*pb.ShuffleRange
ColumnSize []int64
MaxObjectRowCount uint32 // Maximum row count among all objects in the table
MinObjectRowCount uint32 // Minimum row count among all objects in the table
BlockNumber int64
AccurateObjectNumber int64
ApproxObjectNumber int64
TableRowCount float64 // Total row count in the table
}
func NewTableStatsInfo ¶
func NewTableStatsInfo(lenCols int) *TableStatsInfo
type UnorderedSet ¶ added in v1.2.1
func (UnorderedSet[T]) Find ¶ added in v1.2.1
func (set UnorderedSet[T]) Find(val T) bool
func (UnorderedSet[T]) Insert ¶ added in v1.2.1
func (set UnorderedSet[T]) Insert(val T)
type UpdateBinder ¶ added in v0.8.0
type UpdateBinder struct {
// contains filtered or unexported fields
}
func NewUpdateBinder ¶ added in v0.8.0
func NewUpdateBinder(sysCtx context.Context, builder *QueryBuilder, ctx *BindContext, cols []*ColDef) *UpdateBinder
use for on duplicate key update clause: eg: insert into t1 values(1,1),(2,2) on duplicate key update a = a + abs(b), b = values(b)-2
func (*UpdateBinder) BindAggFunc ¶ added in v0.8.0
func (*UpdateBinder) BindColRef ¶ added in v0.8.0
func (b *UpdateBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
func (*UpdateBinder) BindSubquery ¶ added in v0.8.0
func (*UpdateBinder) BindTimeWindowFunc ¶ added in v1.1.0
func (*UpdateBinder) BindWinFunc ¶ added in v0.8.0
func (*UpdateBinder) GetContext ¶ added in v0.8.0
type VisitPlan ¶ added in v0.6.0
type VisitPlan struct {
// contains filtered or unexported fields
}
func NewVisitPlan ¶ added in v0.6.0
func NewVisitPlan(pl *Plan, rules []VisitPlanRule) *VisitPlan
type VisitPlanRule ¶ added in v0.6.0
type WhereBinder ¶ added in v0.5.0
type WhereBinder struct {
// contains filtered or unexported fields
}
func NewWhereBinder ¶ added in v0.5.0
func NewWhereBinder(builder *QueryBuilder, ctx *BindContext) *WhereBinder
func (*WhereBinder) BindAggFunc ¶ added in v0.5.0
func (*WhereBinder) BindColRef ¶ added in v0.5.0
func (b *WhereBinder) BindColRef(astExpr *tree.UnresolvedName, depth int32, isRoot bool) (*plan.Expr, error)
func (*WhereBinder) BindSubquery ¶ added in v0.5.0
func (*WhereBinder) BindTimeWindowFunc ¶ added in v1.1.0
func (*WhereBinder) BindWinFunc ¶ added in v0.5.0
func (*WhereBinder) GetContext ¶ added in v0.7.0
Source Files
¶
- agg_pushdown_pullup.go
- alter_util.go
- apply_indices.go
- apply_indices_cagra.go
- apply_indices_fulltext.go
- apply_indices_hnsw.go
- apply_indices_ivfflat.go
- apply_indices_ivfpq.go
- apply_indices_master.go
- apply_indices_vector.go
- associative_law.go
- base_binder.go
- bind_context.go
- bind_delete.go
- bind_insert.go
- bind_load.go
- bind_replace.go
- bind_update.go
- binding.go
- build.go
- build_alter_add_column.go
- build_alter_add_primarykey.go
- build_alter_change_column.go
- build_alter_modify_column.go
- build_alter_rename_column.go
- build_alter_table.go
- build_constraint_util.go
- build_dcl.go
- build_ddl.go
- build_delete.go
- build_dml_util.go
- build_index_util.go
- build_insert.go
- build_load.go
- build_sample.go
- build_show.go
- build_show_util.go
- build_table_clone.go
- build_transation.go
- build_update.go
- build_util.go
- build_values.go
- build_vector_index_util.go
- const.go
- current_account.go
- deepcopy.go
- default_binder.go
- distinct_agg.go
- dml_context.go
- expr_hash.go
- expr_opt.go
- external.go
- filter_predicate.go
- flatten_subquery.go
- fromOldFunction.go
- fulltext.go
- generate_series.go
- generated_col_binder.go
- group_binder.go
- having_binder.go
- index_helpers.go
- join_order.go
- limit_binder.go
- load_file_chunks.go
- make.go
- message.go
- meta_scan.go
- metadata_scan.go
- mock.go
- mysql_compatibility.go
- mysql_special_types.go
- ondup_update_binder.go
- opt_misc.go
- optimize.go
- order_binder.go
- parse_jsonl_tvf.go
- partition_binder.go
- plugin.go
- plugin_builder.go
- plugin_context.go
- processlist.go
- projection_binder.go
- pushdown.go
- query_builder.go
- result_scan.go
- runtime_filter.go
- set_binder.go
- shuffle.go
- shuffle_algo.go
- stage.go
- stats.go
- system_view.go
- table_binder.go
- table_stats.go
- tools.go
- types.go
- unnest.go
- update_binder.go
- utils.go
- visit_plan.go
- visit_plan_rule.go
- where_binder.go
- window_binder.go