Documentation ¶
Index ¶
- Constants
- func NewColumn(n ColumnName, t ColumnType) *mxmock.Column
- func NewColumnsFromColumnsDescriptions(columnDescs MetricsDescriptions) (Columns, ColumnSpecs)
- func Size(t MetricsType) int64
- type ColumnName
- type ColumnSpec
- type ColumnSpecs
- type ColumnType
- type Columns
- type Config
- type DurationGenerator
- type GUC
- type GUCs
- type Index
- type IndexType
- type Indexes
- type Mars2BTree
- type Mars3BTree
- type Metadata
- func (meta *Metadata) GetDDL() string
- func (meta *Metadata) GetFixedStartEndTSArgGenerator(startTime, endTime string) DurationGenerator
- func (meta *Metadata) GetGUCs() string
- func (meta *Metadata) GetRandomStartEndTSArgGenerator(duration time.Duration) DurationGenerator
- func (meta *Metadata) GetRandomVinsGenerator(num int) func() string
- func (meta *Metadata) GetSingleVinGenerator() SingleVinGenerator
- func (meta *Metadata) GetTableSizeSQL() string
- func (meta *Metadata) ToJSONColStr(jsonColumnsDescs MetricsDescriptions, jsonMetricsNum int64) string
- func (meta *Metadata) ToJSONSelectStr(jsonColumnsDescs MetricsDescriptions, tableAlias string, jsonMetricsNum int64) string
- type MetricsDescription
- type MetricsDescriptions
- type MetricsType
- type MultiVinsGenerator
- type Option
- type Options
- type SingleVinGenerator
- type StorageType
- type Table
- func NewHeapTable(cfg *Config) (*Table, error)
- func NewMarsTable(cfg *Config, st StorageType) (*Table, error)
- func NewTable(cfg *Config, st StorageType) (*Table, error)
- func NewTableFromColumns(schemaName, tableName string, columns Columns) (*Table, error)
- func NewTableFromDB(cfg *Config) (*Table, error)
Constants ¶
View Source
const ( ColumnNameTS = "ts" ColumnNameVIN = "vin" ColumnNameExt = "ext" )
View Source
const ( TSColumnIndex = 0 // ts column is supposed to be the first column VINColumnIndex = 1 // vin column is supposed to be the second column )
View Source
const ( ColumnSizeVin int64 = 32 // TODO: average vin size ColumnSizeTimestamp int64 = 8 ColumnSizeTimestampTZ int64 = 8 )
View Source
const ( // TODO: make it configurable MAX_SIMPLE_COLUMN_NUM = 1000 NON_METRICS_COLUMN_NUM = 2 // ts, vin EXT_COLUMN_NUM = 1 // only 1 ext column, json/jsonb )
View Source
const (
OutOrderDuration = 24 * time.Hour
)
Variables ¶
This section is empty.
Functions ¶
func NewColumn ¶
func NewColumn(n ColumnName, t ColumnType) *mxmock.Column
func NewColumnsFromColumnsDescriptions ¶
func NewColumnsFromColumnsDescriptions(columnDescs MetricsDescriptions) (Columns, ColumnSpecs)
NewColumnsFromColumnsDescriptions creates a slice of columns accord to columnDescs
func Size ¶
func Size(t MetricsType) int64
Types ¶
type ColumnName ¶
type ColumnName = string
type ColumnSpec ¶
type ColumnSpec struct { IsExt bool `json:"is-ext"` ColumnsDescriptions MetricsDescriptions `json:"columns-descriptions"` Name string `json:"name"` Min float64 `json:"min"` Max float64 `json:"max"` IsRounded bool `json:"is-rounded"` DecimalPlaces uint `json:"decimal-places"` }
func NewExtColumnFromColumnsDescriptions ¶
func NewExtColumnFromColumnsDescriptions(n ColumnName, t ColumnType, columnsDescs MetricsDescriptions) (*mxmock.Column, *ColumnSpec, error)
NewExtColumnFromColumnsDescriptions creates a column with the name n and type t. For it will be used as the ext column, a specification to indicate its usage and included metrics is to be properly set.
type ColumnSpecs ¶
type ColumnSpecs []*ColumnSpec
type ColumnType ¶
type ColumnType = string
const ( ColumnTypeTimestamp ColumnType = "timestamp" ColumnTypeTimestampTZ ColumnType = "timestamptz" ColumnTypeText ColumnType = "text" ColumnTypeVarChar ColumnType = "varchar" ColumnTypeInt4 = "int4" ColumnTypeInt8 = "int8" ColumnTypeJSON ColumnType = "json" ColumnTypeJSONB ColumnType = "jsonb" )
type Columns ¶
func (Columns) ToSelectSQLStr ¶
type Config ¶
type Config struct { SchemaName string TableName string TagNum int64 StartAt time.Time EndAt time.Time PartitionIntervalInHour int64 MetricsType MetricsType StorageType StorageType TotalMetricsCount int64 MetricsDescriptions string TimestampStepInSecond uint64 HasUniqueConstraints bool EmptyValueRatio int IsDDLFromFile bool DB util.DBConnParams DBVersion util.DBVersion }
type DurationGenerator ¶
type GUC ¶
func NewGUCForBothRoles ¶
type Index ¶
type Index interface {
GetCreateIndexSQLStr() string
}
func NewMars2BTree ¶
func NewMars3BTree ¶
type Mars2BTree ¶
type Mars2BTree struct { Table *Table UniqueMode bool // TODO: time_bucket related settings are deprecated in mars2_btree TimeBucketInSecond int TimestampColumn ColumnName TagColumn ColumnName // contains filtered or unexported fields }
func (*Mars2BTree) GetCreateIndexSQLStr ¶
func (s *Mars2BTree) GetCreateIndexSQLStr() string
func (*Mars2BTree) Identifier ¶
func (s *Mars2BTree) Identifier() string
type Mars3BTree ¶
type Mars3BTree struct { Table *Table TimestampColumn ColumnName TagColumn ColumnName // contains filtered or unexported fields }
func (*Mars3BTree) GetCreateIndexSQLStr ¶
func (s *Mars3BTree) GetCreateIndexSQLStr() string
func (*Mars3BTree) Identifier ¶
func (s *Mars3BTree) Identifier() string
type Metadata ¶
func (*Metadata) GetFixedStartEndTSArgGenerator ¶
func (meta *Metadata) GetFixedStartEndTSArgGenerator(startTime, endTime string) DurationGenerator
func (*Metadata) GetRandomStartEndTSArgGenerator ¶
func (meta *Metadata) GetRandomStartEndTSArgGenerator(duration time.Duration) DurationGenerator
func (*Metadata) GetRandomVinsGenerator ¶
func (*Metadata) GetSingleVinGenerator ¶
func (meta *Metadata) GetSingleVinGenerator() SingleVinGenerator
func (*Metadata) GetTableSizeSQL ¶
func (*Metadata) ToJSONColStr ¶
func (meta *Metadata) ToJSONColStr(jsonColumnsDescs MetricsDescriptions, jsonMetricsNum int64) string
func (*Metadata) ToJSONSelectStr ¶
func (meta *Metadata) ToJSONSelectStr(jsonColumnsDescs MetricsDescriptions, tableAlias string, jsonMetricsNum int64) string
type MetricsDescription ¶
type MetricsDescription struct { MetricsType MetricsType `json:"type"` Count int64 `json:"count"` Spec ColumnSpec `json:"comment"` }
type MetricsDescriptions ¶
type MetricsDescriptions []*MetricsDescription
type MetricsType ¶
type MetricsType = ColumnType
const ( MetricsTypeFloat4 MetricsType = "float4" MetricsTypeFloat8 MetricsType = "float8" MetricsTypeInt4 MetricsType = "int4" MetricsTypeInt8 MetricsType = "int8" MetricsTypeJSON MetricsType = "json" MetricsTypeJSONB MetricsType = "jsonb" )
type MultiVinsGenerator ¶
type MultiVinsGenerator func() string
type SingleVinGenerator ¶
type SingleVinGenerator func() string
type StorageType ¶
type StorageType = string
const ( StorageMars2 StorageType = "mars2" StorageMars3 StorageType = "mars3" StorageHeap StorageType = "heap" )
type Table ¶
type Table struct { Columns Columns ColumnSpecs ColumnSpecs TotalMetricsCount int64 JSONMetricsCount int64 JSONMetricsCandidateType MetricsType ColumnNameTS, ColumnNameVIN, ColumnNameExt string ColumnTypeTS, ColumnTypeVIN, ColumnTypeExt ColumnType ExtColumn *mxmock.Column ColumnsDescsExt MetricsDescriptions VinValues []string // if it is from DDL, then the fields below are disabled // TODO: may also do initialization in the future DistKey string OrderByKey []string Storage StorageType Options Options Indexes Indexes // contains filtered or unexported fields }
func NewHeapTable ¶
func NewMarsTable ¶
func NewMarsTable(cfg *Config, st StorageType) (*Table, error)
NewMarsTable creates a mars2 or mars3 table with an index according to config.
func NewTableFromColumns ¶
func NewTableFromDB ¶
func (*Table) Identifier ¶
func (*Table) SingleRowMetricsSize ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.