infoschema: support define decimal for virtual table in information_schema (#14896)
Signed-off-by: Lonng <heng@lonng.org>
This commit is contained in:
@ -40,7 +40,7 @@ var memTableToClusterTables = map[string]string{
|
||||
}
|
||||
|
||||
func init() {
|
||||
var addrCol = columnInfo{"INSTANCE", mysql.TypeVarchar, 64, 0, nil, nil}
|
||||
var addrCol = columnInfo{name: "INSTANCE", tp: mysql.TypeVarchar, size: 64}
|
||||
for memTableName, clusterMemTableName := range memTableToClusterTables {
|
||||
memTableCols := tableNameToColumns[memTableName]
|
||||
if len(memTableCols) == 0 {
|
||||
|
||||
@ -84,16 +84,16 @@ func GetMetricTableDef(lowerTableName string) (*MetricTableDef, error) {
|
||||
|
||||
func (def *MetricTableDef) genColumnInfos() []columnInfo {
|
||||
cols := []columnInfo{
|
||||
{"time", mysql.TypeDatetime, 19, 0, "CURRENT_TIMESTAMP", nil},
|
||||
{name: "time", tp: mysql.TypeDatetime, size: 19, deflt: "CURRENT_TIMESTAMP"},
|
||||
}
|
||||
for _, label := range def.Labels {
|
||||
cols = append(cols, columnInfo{label, mysql.TypeVarchar, 512, 0, nil, nil})
|
||||
cols = append(cols, columnInfo{name: label, tp: mysql.TypeVarchar, size: 512})
|
||||
}
|
||||
if def.Quantile > 0 {
|
||||
defaultValue := strconv.FormatFloat(def.Quantile, 'f', -1, 64)
|
||||
cols = append(cols, columnInfo{"quantile", mysql.TypeDouble, 22, 0, defaultValue, nil})
|
||||
cols = append(cols, columnInfo{name: "quantile", tp: mysql.TypeDouble, size: 22, deflt: defaultValue})
|
||||
}
|
||||
cols = append(cols, columnInfo{"value", mysql.TypeDouble, 22, 0, nil, nil})
|
||||
cols = append(cols, columnInfo{name: "value", tp: mysql.TypeDouble, size: 22})
|
||||
return cols
|
||||
}
|
||||
|
||||
|
||||
1191
infoschema/tables.go
1191
infoschema/tables.go
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user