infoschema: support define decimal for virtual table in information_schema (#14896)

Signed-off-by: Lonng <heng@lonng.org>
This commit is contained in:
Lonng
2020-02-21 21:04:26 +08:00
committed by GitHub
parent 6d4e24f417
commit 61ac7ce2ea
3 changed files with 601 additions and 600 deletions

View File

@ -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 {

View File

@ -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
}

File diff suppressed because it is too large Load Diff