catalog

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CatalogVersion_V1 uint32 = 1

	CatalogVersion_Curr uint32 = CatalogVersion_V1
)
View Source
const (
	Row_ID               = "__mo_rowid"
	PrefixPriColName     = "__mo_cpkey_"
	PrefixCBColName      = "__mo_cbkey_"
	PrefixIndexTableName = "__mo_index_"
	// Compound primary key column name, which is a hidden column
	CPrimaryKeyColName = "__mo_cpkey_col"
	// FakePrimaryKeyColName for tables without a primary key, a new hidden primary key column
	// is added, which will not be sorted or used for any other purpose, but will only be used to add
	// locks to the Lock operator in pessimistic transaction mode.
	FakePrimaryKeyColName = "__mo_fake_pk_col"
	// IndexTable has two column at most, the first is idx col, the second is origin table primary col
	IndexTableIndexColName        = "__mo_index_idx_col"
	IndexTablePrimaryColName      = "__mo_index_pri_col"
	ExternalFilePath              = "__mo_filepath"
	UniqueIndexSuffix             = "unique_"
	SecondaryIndexSuffix          = "secondary_"
	UniqueIndexTableNamePrefix    = PrefixIndexTableName + UniqueIndexSuffix
	SecondaryIndexTableNamePrefix = PrefixIndexTableName + SecondaryIndexSuffix
	IndexTableNamePrefix          = PrefixIndexTableName
	// MOAutoIncrTable mo auto increment table name
	MOAutoIncrTable = "mo_increment_columns"
	// TableTailAttr are attrs in table tail
	TableTailAttrCommitTs = "__mo_%1_commit_time"
	TableTailAttrAborted  = "__mo_%1_aborted"
	TableTailAttrPKVal    = "__mo_%1_pk_val"

	// MOForeignKeys saves the fk relationships
	MOForeignKeys = "mo_foreign_keys"
)
View Source
const (
	System_User    = uint32(0)
	System_Role    = uint32(0)
	System_Account = uint32(0)
)
View Source
const (
	// Non-hard-coded data dictionary table
	MO_INDEXES = "mo_indexes"

	// MO_TABLE_PARTITIONS Data dictionary table of record table partition
	MO_TABLE_PARTITIONS = "mo_table_partitions"

	// MOTaskDB mo task db name
	MOTaskDB = "mo_task"

	// MOSysDaemonTask is the table name of daemon task table in mo_task.
	MOSysDaemonTask = "sys_daemon_task"

	// MOStages if the table name of mo_stages table in mo_cataglog.
	MO_STAGES = "mo_stages"
)
View Source
const (
	MO_SYSTEM    = "system"
	MO_STATEMENT = "statement_info"

	MO_SYSTEM_METRICS = "system_metrics"
	MO_METRIC         = "metric"
	MO_SQL_STMT_CU    = "sql_statement_cu"

	// default database name for catalog
	MO_CATALOG  = "mo_catalog"
	MO_DATABASE = "mo_database"
	MO_TABLES   = "mo_tables"
	MO_COLUMNS  = "mo_columns"

	// 'mo_database' table
	SystemDBAttr_ID          = "dat_id"
	SystemDBAttr_Name        = "datname"
	SystemDBAttr_CatalogName = "dat_catalog_name"
	SystemDBAttr_CreateSQL   = "dat_createsql"
	SystemDBAttr_Owner       = "owner"
	SystemDBAttr_Creator     = "creator"
	SystemDBAttr_CreateAt    = "created_time"
	SystemDBAttr_AccID       = "account_id"
	SystemDBAttr_Type        = "dat_type"

	// 'mo_tables' table
	SystemRelAttr_ID             = "rel_id"
	SystemRelAttr_Name           = "relname"
	SystemRelAttr_DBName         = "reldatabase"
	SystemRelAttr_DBID           = "reldatabase_id"
	SystemRelAttr_Persistence    = "relpersistence"
	SystemRelAttr_Kind           = "relkind"
	SystemRelAttr_Comment        = "rel_comment"
	SystemRelAttr_CreateSQL      = "rel_createsql"
	SystemRelAttr_CreateAt       = "created_time"
	SystemRelAttr_Creator        = "creator"
	SystemRelAttr_Owner          = "owner"
	SystemRelAttr_AccID          = "account_id"
	SystemRelAttr_Partitioned    = "partitioned"
	SystemRelAttr_Partition      = "partition_info"
	SystemRelAttr_ViewDef        = "viewdef"
	SystemRelAttr_Constraint     = "constraint"
	SystemRelAttr_Version        = "rel_version"
	SystemRelAttr_CatalogVersion = "catalog_version"

	// 'mo_indexes' table
	IndexAlgoName      = "algo"
	IndexAlgoTableType = "algo_table_type"
	IndexAlgoParams    = "algo_params"

	// 'mo_columns' table
	SystemColAttr_UniqName        = "att_uniq_name"
	SystemColAttr_AccID           = "account_id"
	SystemColAttr_Name            = "attname"
	SystemColAttr_DBID            = "att_database_id"
	SystemColAttr_DBName          = "att_database"
	SystemColAttr_RelID           = "att_relname_id"
	SystemColAttr_RelName         = "att_relname"
	SystemColAttr_Type            = "atttyp"
	SystemColAttr_Num             = "attnum"
	SystemColAttr_Length          = "att_length"
	SystemColAttr_NullAbility     = "attnotnull"
	SystemColAttr_HasExpr         = "atthasdef"
	SystemColAttr_DefaultExpr     = "att_default"
	SystemColAttr_IsDropped       = "attisdropped"
	SystemColAttr_ConstraintType  = "att_constraint_type"
	SystemColAttr_IsUnsigned      = "att_is_unsigned"
	SystemColAttr_IsAutoIncrement = "att_is_auto_increment"
	SystemColAttr_Comment         = "att_comment"
	SystemColAttr_IsHidden        = "att_is_hidden"
	SystemColAttr_HasUpdate       = "attr_has_update"
	SystemColAttr_Update          = "attr_update"
	SystemColAttr_IsClusterBy     = "attr_is_clusterby"
	SystemColAttr_Seqnum          = "attr_seqnum"
	SystemColAttr_EnumValues      = "attr_enum"

	BlockMeta_ID              = "block_id"
	BlockMeta_Delete_ID       = "block_delete_id"
	BlockMeta_EntryState      = "entry_state"
	BlockMeta_Sorted          = "sorted"
	BlockMeta_BlockInfo       = "%!%mo__block_info"
	BlockMeta_MetaLoc         = "%!%mo__meta_loc"
	BlockMeta_DeltaLoc        = "delta_loc"
	BlockMeta_CommitTs        = "committs"
	BlockMeta_SegmentID       = "segment_id"
	BlockMeta_MemTruncPoint   = "trunc_pointt"
	BlockMeta_TableIdx_Insert = "%!%mo__meta_tbl_index" // mark which table this metaLoc belongs to
	BlockMeta_Type            = "%!%mo__meta_type"
	BlockMeta_Deletes_Length  = "%!%mo__meta_deletes_length"
	BlockMeta_Partition       = "%!%mo__meta_partition"

	ObjectMeta_ObjectStats = "object_stats"

	// BlockMetaOffset_Min       = "%!%mo__meta_offset_min"
	// BlockMetaOffset_Max       = "%!%mo__meta_offset_max"
	BlockMetaOffset    = "%!%mo__meta_offset"
	SystemCatalogName  = "def"
	SystemPersistRel   = "p"
	SystemTransientRel = "t"

	SystemOrdinaryRel     = "r"
	SystemIndexRel        = "i"
	SystemSequenceRel     = "S"
	SystemViewRel         = "v"
	SystemMaterializedRel = "m"
	SystemExternalRel     = plan.SystemExternalRel
	SystemStreamRel       = "s"
	//the cluster table created by the sys account
	//and read only by the general account
	SystemClusterRel = "cluster"
	/*
		the partition table contains the data of the partition.
		the table partitioned has multiple partition tables
	*/
	SystemPartitionRel = "partition"

	SystemColPKConstraint = "p"
	SystemColNoConstraint = "n"

	SystemDBTypeSubscription = "subscription"
)
View Source
const (
	// default database id for catalog
	MO_CATALOG_ID  = 1
	MO_DATABASE_ID = 1
	MO_TABLES_ID   = 2
	MO_COLUMNS_ID  = 3

	// MO_RESERVED_MAX is the max reserved table ID.
	MO_RESERVED_MAX = 100
)
View Source
const (
	MO_TABLES_ALTER_TABLE       = 0
	MO_TABLES_UPDATE_CONSTRAINT = 4
)

index use to update constraint

View Source
const (
	MO_DATABASE_DAT_ID_IDX           = 0
	MO_DATABASE_DAT_NAME_IDX         = 1
	MO_DATABASE_DAT_CATALOG_NAME_IDX = 2
	MO_DATABASE_CREATESQL_IDX        = 3
	MO_DATABASE_OWNER_IDX            = 4
	MO_DATABASE_CREATOR_IDX          = 5
	MO_DATABASE_CREATED_TIME_IDX     = 6
	MO_DATABASE_ACCOUNT_ID_IDX       = 7
	MO_DATABASE_DAT_TYPE_IDX         = 8

	MO_TABLES_REL_ID_IDX          = 0
	MO_TABLES_REL_NAME_IDX        = 1
	MO_TABLES_RELDATABASE_IDX     = 2
	MO_TABLES_RELDATABASE_ID_IDX  = 3
	MO_TABLES_RELPERSISTENCE_IDX  = 4
	MO_TABLES_RELKIND_IDX         = 5
	MO_TABLES_REL_COMMENT_IDX     = 6
	MO_TABLES_REL_CREATESQL_IDX   = 7
	MO_TABLES_CREATED_TIME_IDX    = 8
	MO_TABLES_CREATOR_IDX         = 9
	MO_TABLES_OWNER_IDX           = 10
	MO_TABLES_ACCOUNT_ID_IDX      = 11
	MO_TABLES_PARTITIONED_IDX     = 12
	MO_TABLES_PARTITION_INFO_IDX  = 13
	MO_TABLES_VIEWDEF_IDX         = 14
	MO_TABLES_CONSTRAINT_IDX      = 15
	MO_TABLES_VERSION_IDX         = 16
	MO_TABLES_CATALOG_VERSION_IDX = 17

	MO_COLUMNS_ATT_UNIQ_NAME_IDX         = 0
	MO_COLUMNS_ACCOUNT_ID_IDX            = 1
	MO_COLUMNS_ATT_DATABASE_ID_IDX       = 2
	MO_COLUMNS_ATT_DATABASE_IDX          = 3
	MO_COLUMNS_ATT_RELNAME_ID_IDX        = 4
	MO_COLUMNS_ATT_RELNAME_IDX           = 5
	MO_COLUMNS_ATTNAME_IDX               = 6
	MO_COLUMNS_ATTTYP_IDX                = 7
	MO_COLUMNS_ATTNUM_IDX                = 8
	MO_COLUMNS_ATT_LENGTH_IDX            = 9
	MO_COLUMNS_ATTNOTNULL_IDX            = 10
	MO_COLUMNS_ATTHASDEF_IDX             = 11
	MO_COLUMNS_ATT_DEFAULT_IDX           = 12
	MO_COLUMNS_ATTISDROPPED_IDX          = 13
	MO_COLUMNS_ATT_CONSTRAINT_TYPE_IDX   = 14
	MO_COLUMNS_ATT_IS_UNSIGNED_IDX       = 15
	MO_COLUMNS_ATT_IS_AUTO_INCREMENT_IDX = 16
	MO_COLUMNS_ATT_COMMENT_IDX           = 17
	MO_COLUMNS_ATT_IS_HIDDEN_IDX         = 18
	MO_COLUMNS_ATT_HAS_UPDATE_IDX        = 19
	MO_COLUMNS_ATT_UPDATE_IDX            = 20
	MO_COLUMNS_ATT_IS_CLUSTERBY          = 21
	MO_COLUMNS_ATT_SEQNUM_IDX            = 22
	MO_COLUMNS_ATT_ENUM_IDX              = 23

	BLOCKMETA_ID_IDX            = 0
	BLOCKMETA_ENTRYSTATE_IDX    = 1
	BLOCKMETA_SORTED_IDX        = 2
	BLOCKMETA_METALOC_IDX       = 3
	BLOCKMETA_DELTALOC_IDX      = 4
	BLOCKMETA_COMMITTS_IDX      = 5
	BLOCKMETA_SEGID_IDX         = 6
	BLOCKMETA_MemTruncPoint_IDX = 7

	SKIP_ROWID_OFFSET = 1 //rowid is the 0th vector in the batch
)

column's index in catalog table

View Source
const (
	QUERY_ID_IDX     = 0
	STATEMENT_IDX    = 1
	ACCOUNT_ID_IDX   = 2
	ROLE_ID_IDX      = 3
	RESULT_PATH_IDX  = 4
	CREATE_TIME_IDX  = 5
	RESULT_SIZE_IDX  = 6
	COLUMNS_IDX      = 7
	TABLES_IDX       = 8
	USER_ID_IDX      = 9
	EXPIRED_TIME_IDX = 10
	PLAN_IDX         = 11
	AST_IDX          = 12
	COLUMN_MAP_IDX   = 13
)
View Source
const (
	AliasPrefix = "__mo_alias_"
)
View Source
const (
	BlockInfoSize = unsafe.Sizeof(BlockInfo{})
)
View Source
const (
	Meta_Length = 6
)
View Source
const (
	MoIndexDefaultAlgo = tree.INDEX_TYPE_INVALID // used by UniqueIndex or default SecondaryIndex

)

Index Algorithm names

View Source
const QueryResultMetaName = "%s_%s.blk"
View Source
const QueryResultName = "%s_%s_%d.blk"

Variables

View Source
var (
	MoDatabaseSchema = []string{
		SystemDBAttr_ID,
		SystemDBAttr_Name,
		SystemDBAttr_CatalogName,
		SystemDBAttr_CreateSQL,
		SystemDBAttr_Owner,
		SystemDBAttr_Creator,
		SystemDBAttr_CreateAt,
		SystemDBAttr_AccID,
		SystemDBAttr_Type,
	}
	MoTablesSchema = []string{
		SystemRelAttr_ID,
		SystemRelAttr_Name,
		SystemRelAttr_DBName,
		SystemRelAttr_DBID,
		SystemRelAttr_Persistence,
		SystemRelAttr_Kind,
		SystemRelAttr_Comment,
		SystemRelAttr_CreateSQL,
		SystemRelAttr_CreateAt,
		SystemRelAttr_Creator,
		SystemRelAttr_Owner,
		SystemRelAttr_AccID,
		SystemRelAttr_Partitioned,
		SystemRelAttr_Partition,
		SystemRelAttr_ViewDef,
		SystemRelAttr_Constraint,
		SystemRelAttr_Version,
		SystemRelAttr_CatalogVersion,
	}
	MoTablesSchema_V1 = []string{
		SystemRelAttr_ID,
		SystemRelAttr_Name,
		SystemRelAttr_DBName,
		SystemRelAttr_DBID,
		SystemRelAttr_Persistence,
		SystemRelAttr_Kind,
		SystemRelAttr_Comment,
		SystemRelAttr_CreateSQL,
		SystemRelAttr_CreateAt,
		SystemRelAttr_Creator,
		SystemRelAttr_Owner,
		SystemRelAttr_AccID,
		SystemRelAttr_Partitioned,
		SystemRelAttr_Partition,
		SystemRelAttr_ViewDef,
		SystemRelAttr_Constraint,
		SystemRelAttr_Version,
	}
	MoColumnsSchema = []string{
		SystemColAttr_UniqName,
		SystemColAttr_AccID,
		SystemColAttr_DBID,
		SystemColAttr_DBName,
		SystemColAttr_RelID,
		SystemColAttr_RelName,
		SystemColAttr_Name,
		SystemColAttr_Type,
		SystemColAttr_Num,
		SystemColAttr_Length,
		SystemColAttr_NullAbility,
		SystemColAttr_HasExpr,
		SystemColAttr_DefaultExpr,
		SystemColAttr_IsDropped,
		SystemColAttr_ConstraintType,
		SystemColAttr_IsUnsigned,
		SystemColAttr_IsAutoIncrement,
		SystemColAttr_Comment,
		SystemColAttr_IsHidden,
		SystemColAttr_HasUpdate,
		SystemColAttr_Update,
		SystemColAttr_IsClusterBy,
		SystemColAttr_Seqnum,
		SystemColAttr_EnumValues,
	}
	MoColumnsSchema_V1 = []string{
		SystemColAttr_UniqName,
		SystemColAttr_AccID,
		SystemColAttr_DBID,
		SystemColAttr_DBName,
		SystemColAttr_RelID,
		SystemColAttr_RelName,
		SystemColAttr_Name,
		SystemColAttr_Type,
		SystemColAttr_Num,
		SystemColAttr_Length,
		SystemColAttr_NullAbility,
		SystemColAttr_HasExpr,
		SystemColAttr_DefaultExpr,
		SystemColAttr_IsDropped,
		SystemColAttr_ConstraintType,
		SystemColAttr_IsUnsigned,
		SystemColAttr_IsAutoIncrement,
		SystemColAttr_Comment,
		SystemColAttr_IsHidden,
		SystemColAttr_HasUpdate,
		SystemColAttr_Update,
		SystemColAttr_IsClusterBy,
		SystemColAttr_Seqnum,
	}
	MoTableMetaSchema = []string{
		BlockMeta_ID,
		BlockMeta_EntryState,
		BlockMeta_Sorted,
		BlockMeta_MetaLoc,
		BlockMeta_DeltaLoc,
		BlockMeta_CommitTs,
		BlockMeta_SegmentID,
		BlockMeta_MemTruncPoint,
	}
	MoTableMetaSchemaV1 = []string{
		BlockMeta_ID,
		BlockMeta_EntryState,
		BlockMeta_Sorted,
		BlockMeta_MetaLoc,
		BlockMeta_DeltaLoc,
		BlockMeta_CommitTs,
		BlockMeta_SegmentID,
	}
	MoDatabaseTypes = []types.Type{
		types.New(types.T_uint64, 0, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_timestamp, 0, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_varchar, 32, 0),
	}
	MoTablesTypes = []types.Type{
		types.New(types.T_uint64, 0, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_uint64, 0, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_text, 0, 0),
		types.New(types.T_timestamp, 0, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_blob, 0, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_uint32, 0, 0),
	}
	MoTablesTypes_V1 = []types.Type{
		types.New(types.T_uint64, 0, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_uint64, 0, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_text, 0, 0),
		types.New(types.T_timestamp, 0, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_blob, 0, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_varchar, 5000, 0),
		types.New(types.T_uint32, 0, 0),
	}
	MoColumnsTypes = []types.Type{
		types.New(types.T_varchar, 256, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_uint64, 0, 0),
		types.New(types.T_varchar, 256, 0),
		types.New(types.T_uint64, 0, 0),
		types.New(types.T_varchar, 256, 0),
		types.New(types.T_varchar, 256, 0),
		types.New(types.T_varchar, 256, 0),
		types.New(types.T_int32, 0, 0),
		types.New(types.T_int32, 0, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_varchar, 2048, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_char, 1, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_varchar, 2048, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_varchar, 2048, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_uint16, 0, 0),
		types.New(types.T_varchar, types.MaxVarcharLen, 0),
	}
	MoColumnsTypes_V1 = []types.Type{
		types.New(types.T_varchar, 256, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_uint64, 0, 0),
		types.New(types.T_varchar, 256, 0),
		types.New(types.T_uint64, 0, 0),
		types.New(types.T_varchar, 256, 0),
		types.New(types.T_varchar, 256, 0),
		types.New(types.T_varchar, 256, 0),
		types.New(types.T_int32, 0, 0),
		types.New(types.T_int32, 0, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_varchar, 2048, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_char, 1, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_varchar, 2048, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_varchar, 2048, 0),
		types.New(types.T_int8, 0, 0),
		types.New(types.T_uint16, 0, 0),
	}
	MoTableMetaTypes = []types.Type{
		types.New(types.T_Blockid, 0, 0),
		types.New(types.T_bool, 0, 0),
		types.New(types.T_bool, 0, 0),
		types.New(types.T_varchar, types.MaxVarcharLen, 0),
		types.New(types.T_varchar, types.MaxVarcharLen, 0),
		types.New(types.T_TS, 0, 0),
		types.New(types.T_uuid, 0, 0),
		types.New(types.T_TS, 0, 0),
	}
	MoTableMetaTypesV1 = []types.Type{
		types.New(types.T_Blockid, 0, 0),
		types.New(types.T_bool, 0, 0),
		types.New(types.T_bool, 0, 0),
		types.New(types.T_varchar, types.MaxVarcharLen, 0),
		types.New(types.T_varchar, types.MaxVarcharLen, 0),
		types.New(types.T_TS, 0, 0),
		types.New(types.T_uuid, 0, 0),
	}
	MoTablesIdxs = []uint16{
		MO_TABLES_REL_ID_IDX,
		MO_TABLES_REL_NAME_IDX,
		MO_TABLES_RELDATABASE_IDX,
		MO_TABLES_RELDATABASE_ID_IDX,
		MO_TABLES_RELPERSISTENCE_IDX,
		MO_TABLES_RELKIND_IDX,
		MO_TABLES_REL_COMMENT_IDX,
		MO_TABLES_REL_CREATESQL_IDX,
		MO_TABLES_CREATED_TIME_IDX,
		MO_TABLES_CREATOR_IDX,
		MO_TABLES_OWNER_IDX,
		MO_TABLES_ACCOUNT_ID_IDX,
		MO_TABLES_PARTITIONED_IDX,
		MO_TABLES_PARTITION_INFO_IDX,
		MO_TABLES_VIEWDEF_IDX,
		MO_TABLES_CONSTRAINT_IDX,
		MO_TABLES_VERSION_IDX,
		MO_TABLES_CATALOG_VERSION_IDX,
	}
	MoColumnsIdxs = []uint16{
		MO_COLUMNS_ATT_UNIQ_NAME_IDX,
		MO_COLUMNS_ACCOUNT_ID_IDX,
		MO_COLUMNS_ATT_DATABASE_ID_IDX,
		MO_COLUMNS_ATT_DATABASE_IDX,
		MO_COLUMNS_ATT_RELNAME_ID_IDX,
		MO_COLUMNS_ATT_RELNAME_IDX,
		MO_COLUMNS_ATTNAME_IDX,
		MO_COLUMNS_ATTTYP_IDX,
		MO_COLUMNS_ATTNUM_IDX,
		MO_COLUMNS_ATT_LENGTH_IDX,
		MO_COLUMNS_ATTNOTNULL_IDX,
		MO_COLUMNS_ATTHASDEF_IDX,
		MO_COLUMNS_ATT_DEFAULT_IDX,
		MO_COLUMNS_ATTISDROPPED_IDX,
		MO_COLUMNS_ATT_CONSTRAINT_TYPE_IDX,
		MO_COLUMNS_ATT_IS_UNSIGNED_IDX,
		MO_COLUMNS_ATT_IS_AUTO_INCREMENT_IDX,
		MO_COLUMNS_ATT_COMMENT_IDX,
		MO_COLUMNS_ATT_IS_HIDDEN_IDX,
		MO_COLUMNS_ATT_HAS_UPDATE_IDX,
		MO_COLUMNS_ATT_UPDATE_IDX,
		MO_COLUMNS_ATT_IS_CLUSTERBY,
		MO_COLUMNS_ATT_SEQNUM_IDX,
		MO_COLUMNS_ATT_ENUM_IDX,
	}

	// used by memengine or tae
	MoDatabaseTableDefs = []engine.TableDef{}
	// used by memengine or tae
	MoTablesTableDefs = []engine.TableDef{}
	// used by memengine or tae
	MoColumnsTableDefs = []engine.TableDef{}
	// used by memengine or tae or cn
	MoTableMetaDefs = []engine.TableDef{}
)
View Source
var (
	QueryResultPath     string
	QueryResultMetaPath string
	QueryResultMetaDir  string
	//ProfileDir holds all profiles dumped by the runtime/pprof
	ProfileDir string
)
View Source
var (
	MetaColTypes = []types.Type{
		types.New(types.T_uuid, 0, 0),
		types.New(types.T_text, 0, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_text, 0, 0),
		types.New(types.T_timestamp, 0, 0),
		types.New(types.T_float64, 0, 0),
		types.New(types.T_text, 0, 0),
		types.New(types.T_text, 0, 0),
		types.New(types.T_uint32, 0, 0),
		types.New(types.T_timestamp, 0, 0),
		types.New(types.T_text, 0, 0),
		types.New(types.T_text, 0, 0),
		types.New(types.T_text, 0, 0),
	}

	MetaColNames = []string{
		"query_id",
		"statement",
		"account_id",
		"role_id",
		"result_path",
		"create_time",
		"result_size",
		"columns",
		"tables",
		"user_id",
		"expired_time",
		"plan",
		"Ast",
		"ColumnMap",
	}
)
View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)
View Source
var InternalTableNames = map[string]int8{
	IndexTableNamePrefix: 0,
	MOAutoIncrTable:      0,
}

Functions

func BuildProfilePath added in v1.1.2

func BuildProfilePath(typ, name string) string

func BuildQueryResultMetaPath added in v0.7.0

func BuildQueryResultMetaPath(accountName, statementId string) string

func BuildQueryResultPath added in v0.7.0

func BuildQueryResultPath(accountName, statementId string, blockIdx int) string

func ContainExternalHidenCol added in v0.7.0

func ContainExternalHidenCol(col string) bool

func CreateAlias added in v1.1.0

func CreateAlias(column string) string

func EncodeBlockInfo added in v0.8.0

func EncodeBlockInfo(info BlockInfo) []byte

XXX info is passed in by value. The use of unsafe here will cost an allocation and copy. BlockInfo is not small therefore this is not exactly cheap. However, caller of this function will keep a reference to the buffer. See txnTable.rangesOnePart. ranges is *[][]byte.

func GenRows added in v0.6.0

func GenRows(bat *batch.Batch) [][]any

func IsAlias added in v1.1.0

func IsAlias(column string) bool

func IsHiddenTable added in v0.8.0

func IsHiddenTable(name string) bool

func IsNullIndexAlgo added in v1.1.0

func IsNullIndexAlgo(algo string) bool

IsNullIndexAlgo is used to skip printing the default "" index algo in the restoreDDL and buildShowCreateTable

func ParseEntryList added in v0.6.0

func ParseEntryList(es []*api.Entry) (any, []*api.Entry, error)

consume a set of entries and return a command and the remaining entries

func ResolveAlias added in v1.1.0

func ResolveAlias(alias string) string

Types

type BlockInfo added in v0.6.0

type BlockInfo struct {
	BlockID    types.Blockid
	EntryState bool
	Sorted     bool
	MetaLoc    ObjectLocation
	DeltaLoc   ObjectLocation
	CommitTs   types.TS
	SegmentID  types.Uuid

	//TODO:: putting them here is a bad idea, remove
	//this block can be distributed to remote nodes.
	CanRemote    bool
	PartitionNum int
}

func DecodeBlockInfo added in v0.8.0

func DecodeBlockInfo(buf []byte) *BlockInfo

func GenBlockInfo added in v0.6.0

func GenBlockInfo(rows [][]any) []BlockInfo

func (*BlockInfo) DeltaLocation added in v0.8.0

func (b *BlockInfo) DeltaLocation() objectio.Location

func (*BlockInfo) Descriptor added in v0.8.0

func (*BlockInfo) Descriptor() ([]byte, []int)

func (*BlockInfo) GetEntryState added in v0.8.0

func (m *BlockInfo) GetEntryState() bool

func (*BlockInfo) GetSorted added in v0.8.0

func (m *BlockInfo) GetSorted() bool

func (*BlockInfo) Marshal added in v0.8.0

func (m *BlockInfo) Marshal() (dAtA []byte, err error)

func (*BlockInfo) MarshalTo added in v0.8.0

func (m *BlockInfo) MarshalTo(dAtA []byte) (int, error)

func (*BlockInfo) MarshalToSizedBuffer added in v0.8.0

func (m *BlockInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BlockInfo) MetaLocation added in v0.8.0

func (b *BlockInfo) MetaLocation() objectio.Location

func (*BlockInfo) ProtoMessage added in v0.8.0

func (*BlockInfo) ProtoMessage()

func (*BlockInfo) ProtoSize added in v0.8.0

func (m *BlockInfo) ProtoSize() (n int)

func (*BlockInfo) Reset added in v0.8.0

func (m *BlockInfo) Reset()

func (*BlockInfo) SetDeltaLocation added in v0.8.0

func (b *BlockInfo) SetDeltaLocation(deltaLoc objectio.Location)

func (*BlockInfo) SetMetaLocation added in v0.8.0

func (b *BlockInfo) SetMetaLocation(metaLoc objectio.Location)

func (*BlockInfo) String added in v0.8.0

func (m *BlockInfo) String() string

func (*BlockInfo) Unmarshal added in v0.8.0

func (m *BlockInfo) Unmarshal(dAtA []byte) error

func (*BlockInfo) XXX_DiscardUnknown added in v0.8.0

func (m *BlockInfo) XXX_DiscardUnknown()

func (*BlockInfo) XXX_Marshal added in v0.8.0

func (m *BlockInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BlockInfo) XXX_Merge added in v0.8.0

func (m *BlockInfo) XXX_Merge(src proto.Message)

func (*BlockInfo) XXX_Size added in v0.8.0

func (m *BlockInfo) XXX_Size() int

func (*BlockInfo) XXX_Unmarshal added in v0.8.0

func (m *BlockInfo) XXX_Unmarshal(b []byte) error

type CreateDatabase added in v0.6.0

type CreateDatabase struct {
	DatabaseId  uint64
	Name        string
	CreateSql   string
	DatTyp      string
	Owner       uint32
	Creator     uint32
	AccountId   uint32
	CreatedTime types.Timestamp
}

used for memengine and tae tae and memengine do not make the catalog into a table for its convenience, a conversion interface is provided to ensure easy use.

type CreateTable added in v0.6.0

type CreateTable struct {
	TableId      uint64
	Name         string
	CreateSql    string
	Owner        uint32
	Creator      uint32
	AccountId    uint32
	DatabaseId   uint64
	DatabaseName string
	Comment      string
	Partitioned  int8
	Partition    string
	RelKind      string
	Viewdef      string
	Constraint   []byte
	Defs         []engine.TableDef
}

type DropDatabase added in v0.6.0

type DropDatabase struct {
	Id   uint64
	Name string
}

type DropOrTruncateTable added in v0.6.0

type DropOrTruncateTable struct {
	IsDrop       bool // true for Drop and false for Truncate
	Id           uint64
	NewId        uint64
	Name         string
	DatabaseId   uint64
	DatabaseName string
}

type Meta added in v0.7.0

type Meta struct {
	QueryId     [16]byte
	Statement   string
	AccountId   uint32
	RoleId      uint32
	ResultPath  string
	CreateTime  types.Timestamp
	ResultSize  float64
	Columns     string
	Tables      string
	UserId      uint32
	ExpiredTime types.Timestamp
	Plan        string
	Ast         string
	ColumnMap   string
}

type ObjectLocation added in v0.8.0

type ObjectLocation [objectio.LocationLen]byte

func (*ObjectLocation) Marshal added in v0.8.0

func (m *ObjectLocation) Marshal() ([]byte, error)

Marshal is used by gogoproto.

func (*ObjectLocation) MarshalTo added in v0.8.0

func (m *ObjectLocation) MarshalTo(data []byte) (int, error)

MarshalTo is used by gogoproto.

func (*ObjectLocation) MarshalToSizedBuffer added in v0.8.0

func (m *ObjectLocation) MarshalToSizedBuffer(data []byte) (int, error)

MarshalToSizedBuffer is used by gogoproto.

func (*ObjectLocation) ProtoSize added in v0.8.0

func (m *ObjectLocation) ProtoSize() int

ProtoSize is used by gogoproto.

func (*ObjectLocation) Unmarshal added in v0.8.0

func (m *ObjectLocation) Unmarshal(data []byte) error

Unmarshal is used by gogoproto.

type UpdateConstraint added in v0.7.0

type UpdateConstraint struct {
	DatabaseId   uint64
	TableId      uint64
	TableName    string
	DatabaseName string
	Constraint   []byte
}

Jump to

Keyboard shortcuts

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