Documentation
¶
Index ¶
- Constants
- Variables
- func AppendAnyToStringVector(proc *process.Process, val any, vec *vector.Vector) error
- func BinaryToInt(b string) (uint64, error)
- func BuildCompositeClusterByColumnName(s []string) string
- func BuildIndexTableName(ctx context.Context, unique bool) (string, error)
- func BuildMoColumnsFilter(curAccountId uint64) tree.Expr
- func BuildMoDataBaseFilter(curAccountId uint64) tree.Expr
- func BuildMoTablesFilter(curAccountId uint64) tree.Expr
- func BuildSysMetricFilter(curAccountId uint64) tree.Expr
- func BuildSysStatementInfoFilter(curAccountId uint64) tree.Expr
- func BuildUniqueKeyBatch(vecs []*vector.Vector, attrs []string, parts []string, ...) (*batch.Batch, int, error)
- func ConvertAccountToAccountIdWithTableCheck(astExpr tree.Expr, isSystemAccount bool, currentAccountName string, ...) (tree.Expr, bool)
- func CopyBatch(bat *batch.Batch, proc *process.Process) (*batch.Batch, error)
- func DbIsSystemDb(dbName string) bool
- func DecodeBinaryString(s string) ([]byte, error)
- func FillCompositeClusterByBatch(bat *batch.Batch, cbName string, proc *process.Process) error
- func FillCompositeKeyBatch(bat *batch.Batch, ckeyName string, keyParts []string, proc *process.Process) error
- func GenVectorByVarValue(proc *process.Process, typ types.Type, val any) (*vector.Vector, error)
- func GetClusterByColumnOrder(cbName, colName string) int
- func GetClusterByFirstColumn(cbName string) string
- func GetClusterTableAttributeName() string
- func GetClusterTableAttributeType() *tree.T
- func HexToInt(hex string) (uint64, error)
- func InitPredefinedTables(tables []string)
- func IsClusterTableAttribute(name string) bool
- func IsIndexTableName(tableName string) bool
- func IsValidNameForPartitionTable(name string) bool
- func JudgeIsCompositeClusterByColumn(s string) bool
- func MakeNameOfPartitionTable(partitionName, tableName string) (bool, string)
- func ScoreBinaryToInt(s string) (uint64, error)
- func SetAnyToStringVector(proc *process.Process, val any, vec *vector.Vector, idx int) error
- func SetBytesToAnyVector(ctx context.Context, val string, row int, isNull bool, vec *vector.Vector, ...) error
- func SetInsertValueBit(proc *process.Process, numVal *tree.NumVal, colType *types.Type) (canInsert bool, val uint64, err error)
- func SetInsertValueBool(proc *process.Process, numVal *tree.NumVal) (canInsert bool, num bool, err error)
- func SetInsertValueDate(proc *process.Process, numVal *tree.NumVal, typ *types.Type) (canInsert bool, isnull bool, res types.Date, err error)
- func SetInsertValueDateTime(proc *process.Process, numVal *tree.NumVal, typ *types.Type) (canInsert bool, isnull bool, res types.Datetime, err error)
- func SetInsertValueDecimal64(proc *process.Process, numVal *tree.NumVal, typ *types.Type) (canInsert bool, res types.Decimal64, err error)
- func SetInsertValueDecimal128(proc *process.Process, numVal *tree.NumVal, typ *types.Type) (canInsert bool, res types.Decimal128, err error)
- func SetInsertValueJSON(proc *process.Process, numVal *tree.NumVal) (canInsert bool, val []byte, err error)
- func SetInsertValueNumber[T constraints.Integer | constraints.Float](proc *process.Process, numVal *tree.NumVal, colType *types.Type) (canInsert bool, num T, err error)
- func SetInsertValueString(proc *process.Process, numVal *tree.NumVal, typ *types.Type) (canInsert bool, val []byte, err error)
- func SetInsertValueTime(proc *process.Process, numVal *tree.NumVal, typ *types.Type) (canInsert bool, isnull bool, res types.Time, err error)
- func SetInsertValueTimeStamp(proc *process.Process, numVal *tree.NumVal, typ *types.Type) (canInsert bool, isnull bool, res types.Timestamp, err error)
- func SplitCompositeClusterByColumnName(s string) []string
- func SplitNameOfPartitionTable(name string) (bool, string, string)
- func SplitTableAndColumn(name string) (string, string)
- func TableIsClusterTable(tableType string) bool
- func TableIsLoggingTable(dbName string, tableName string) bool
- func XXHashVectors(vs []*vector.Vector, proc *process.Process, packers *PackerList, ...) ([]uint64, int, error)
- type AccountIdResolver
- type PackerList
Constants ¶
const (
DefaultPackerSize = 4096
)
Variables ¶
var CompactPrimaryCol = compactPrimaryCol
var CompactSingleIndexCol = compactSingleIndexCol
var SerialWithCompacted = serialWithCompacted
var SerialWithoutCompacted = serialWithoutCompacted
Functions ¶
func AppendAnyToStringVector ¶ added in v0.8.0
func BinaryToInt ¶ added in v1.1.1
func BuildCompositeClusterByColumnName ¶ added in v0.7.0
func BuildIndexTableName ¶ added in v0.6.0
func BuildMoColumnsFilter ¶ added in v0.7.0
Build the filter condition AST expression for mo_columns, as follows: account_id = current_id or (account_id = 0 and attr_databse in mo_catalog and att_relname not in other tables)
func BuildMoDataBaseFilter ¶ added in v0.7.0
Build the filter condition AST expression for mo_database, as follows: account_id = cur_accountId or (account_id = 0 and datname in ('mo_catalog'))
func BuildMoTablesFilter ¶ added in v0.7.0
Build the filter condition AST expression for mo_tables, as follows: account_id = cur_account_id or (account_id = 0 and (relname in ('mo_tables','mo_database','mo_columns') or relkind = 'cluster'))
func BuildSysMetricFilter ¶ added in v0.8.0
func BuildSysStatementInfoFilter ¶ added in v0.8.0
func BuildUniqueKeyBatch ¶ added in v0.6.0
func BuildUniqueKeyBatch( vecs []*vector.Vector, attrs []string, parts []string, originTablePrimaryKey string, proc *process.Process, packers *PackerList, ) (*batch.Batch, int, error)
BuildUniqueKeyBatch used in test to validate serialWithCompacted(), compactSingleIndexCol() and compactPrimaryCol()
func ConvertAccountToAccountIdWithTableCheck ¶
func ConvertAccountToAccountIdWithTableCheck(astExpr tree.Expr, isSystemAccount bool, currentAccountName string, currentAccountID uint32, tableAliasMap map[string]bool, accountIdResolver AccountIdResolver) (tree.Expr, bool)
ConvertAccountToAccountIdWithTableCheck converts account column references to account_id comparisons in AST. This conversion is primarily designed for compatibility with mo-cloud's business-level usage of the account field.
The function only handles EQUAL operations (account = 'xxx') for system accounts. For other operations (IN, LIKE, etc.), it keeps the original condition unchanged.
For system accounts (account_id = 0):
- If account = 'sys', it directly converts to account_id = 0 without query
- If account = 'xxx' and accountIdResolver is provided, it queries account_id:
- If account_id is found, replaces with account_id = <id> (can be pushed down to tablescan)
- If account_id is not found, keeps the original account = 'xxx' condition
For non-system accounts:
- No conversion is performed because account_id filter is already added in tablescan during plan building. QueryBuiler::buildTable pkg/sql/plan/query_builder.go:4889
tableAliasMap is a map of table names/aliases that refer to statement_info or metric table. If nil, only checks for unqualified column names or table name "statement_info"/"metric". This map is used to verify if table-qualified column names (e.g., s.account, m.account) refer to statement_info or metric.
This allows mo-cloud to query statement_info or metric table using account names (e.g., WHERE account = 'sys' or WHERE s.account = 'sys') instead of account_ids, providing a more intuitive interface while maintaining compatibility with the underlying account_id-based storage and access control.
Returns the converted AST expression and a boolean indicating if any conversion was made.
func DbIsSystemDb ¶ added in v0.8.0
func DecodeBinaryString ¶ added in v1.1.1
func FillCompositeClusterByBatch ¶ added in v0.7.0
build the clusterBy key's vector of the cluster table according to the composite column name, and append the result vector to batch cbName: column name of composite column
func FillCompositeKeyBatch ¶ added in v0.8.0
func FillCompositeKeyBatch(bat *batch.Batch, ckeyName string, keyParts []string, proc *process.Process) error
build the vector of the composite key, and append the result vector to batch ckeyName: column name of composite column keyParts: parts of the composite column
func GenVectorByVarValue ¶ added in v0.8.0
func GetClusterByColumnOrder ¶ added in v0.7.0
func GetClusterByFirstColumn ¶ added in v1.1.0
func GetClusterTableAttributeName ¶ added in v0.7.0
func GetClusterTableAttributeName() string
func GetClusterTableAttributeType ¶ added in v0.7.0
func InitPredefinedTables ¶ added in v1.2.1
func InitPredefinedTables(tables []string)
func IsClusterTableAttribute ¶ added in v0.7.0
func IsIndexTableName ¶
IsIndexTableName checks if the given table name is an index table name with a valid UUID.
func IsValidNameForPartitionTable ¶ added in v0.8.0
IsValidNameForPartitionTable the name forms the partition table does not have the partitionDelimiter
func JudgeIsCompositeClusterByColumn ¶ added in v0.7.0
func MakeNameOfPartitionTable ¶ added in v0.8.0
MakeNameOfPartitionTable !!!NOTE!!! With assumption: the partition name and the table name does not have partitionDelimiter. partition table name format : %!%partition_name%!%table_name
func ScoreBinaryToInt ¶ added in v1.2.0
func SetAnyToStringVector ¶ added in v0.8.0
func SetBytesToAnyVector ¶ added in v0.8.0
func SetInsertValueBit ¶
func SetInsertValueBool ¶
func SetInsertValueDate ¶
func SetInsertValueDateTime ¶
func SetInsertValueDecimal64 ¶
func SetInsertValueJSON ¶
func SetInsertValueNumber ¶
func SetInsertValueString ¶
func SetInsertValueTime ¶
func SetInsertValueTimeStamp ¶
func SplitCompositeClusterByColumnName ¶ added in v0.7.0
func SplitNameOfPartitionTable ¶ added in v0.8.0
SplitNameOfPartitionTable splits the partition table name into partition name and origin table name
func SplitTableAndColumn ¶
func TableIsClusterTable ¶ added in v0.7.0
TableIsClusterTable check the table type is cluster table
func TableIsLoggingTable ¶ added in v0.8.0
Types ¶
type AccountIdResolver ¶
AccountIdResolver is a function type that resolves account name to account_id. It returns the account_id if found, or an error if not found or on failure. If the account is not found, it should return (0, nil) to indicate the account doesn't exist.
type PackerList ¶ added in v1.2.0
type PackerList struct {
// contains filtered or unexported fields
}
func (*PackerList) Free ¶ added in v1.2.0
func (list *PackerList) Free()
func (*PackerList) PackerCount ¶
func (list *PackerList) PackerCount() int
func (*PackerList) Reset ¶
func (list *PackerList) Reset()
func (*PackerList) ResetN ¶
func (list *PackerList) ResetN(n int)