mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 21:28:59 +08:00
fix: materialize columns api fixed (#7159)
This commit is contained in:
parent
858944d273
commit
b6858fbfd9
@ -3117,17 +3117,17 @@ func (r *ClickHouseReader) UpdateLogFieldV2(ctx context.Context, field *model.Up
|
|||||||
|
|
||||||
colname := utils.GetClickhouseColumnNameV2(field.Type, field.DataType, field.Name)
|
colname := utils.GetClickhouseColumnNameV2(field.Type, field.DataType, field.Name)
|
||||||
|
|
||||||
dataType := strings.ToLower(field.DataType)
|
field.DataType = strings.ToLower(field.DataType)
|
||||||
if dataType == "int64" || dataType == "float64" {
|
dataType := constants.MaterializedDataTypeMap[field.DataType]
|
||||||
dataType = "number"
|
chDataType := constants.ChDataTypeMap[field.DataType]
|
||||||
}
|
|
||||||
attrColName := fmt.Sprintf("%s_%s", field.Type, dataType)
|
attrColName := fmt.Sprintf("%s_%s", field.Type, dataType)
|
||||||
for _, table := range []string{r.logsLocalTableV2, r.logsTableV2} {
|
for _, table := range []string{r.logsLocalTableV2, r.logsTableV2} {
|
||||||
q := "ALTER TABLE %s.%s ON CLUSTER %s ADD COLUMN IF NOT EXISTS `%s` %s DEFAULT %s['%s'] CODEC(ZSTD(1))"
|
q := "ALTER TABLE %s.%s ON CLUSTER %s ADD COLUMN IF NOT EXISTS `%s` %s DEFAULT %s['%s'] CODEC(ZSTD(1))"
|
||||||
query := fmt.Sprintf(q,
|
query := fmt.Sprintf(q,
|
||||||
r.logsDB, table,
|
r.logsDB, table,
|
||||||
r.cluster,
|
r.cluster,
|
||||||
colname, field.DataType,
|
colname, chDataType,
|
||||||
attrColName,
|
attrColName,
|
||||||
field.Name,
|
field.Name,
|
||||||
)
|
)
|
||||||
@ -3356,20 +3356,8 @@ func (r *ClickHouseReader) UpdateTraceField(ctx context.Context, field *model.Up
|
|||||||
field.DataType = strings.ToLower(field.DataType)
|
field.DataType = strings.ToLower(field.DataType)
|
||||||
|
|
||||||
// dataType and chDataType of the materialized column
|
// dataType and chDataType of the materialized column
|
||||||
var dataTypeMap = map[string]string{
|
chDataType := constants.ChDataTypeMap[field.DataType]
|
||||||
"string": "string",
|
dataType := constants.MaterializedDataTypeMap[field.DataType]
|
||||||
"bool": "bool",
|
|
||||||
"int64": "number",
|
|
||||||
"float64": "number",
|
|
||||||
}
|
|
||||||
var chDataTypeMap = map[string]string{
|
|
||||||
"string": "String",
|
|
||||||
"bool": "Bool",
|
|
||||||
"int64": "Float64",
|
|
||||||
"float64": "Float64",
|
|
||||||
}
|
|
||||||
chDataType := chDataTypeMap[field.DataType]
|
|
||||||
dataType := dataTypeMap[field.DataType]
|
|
||||||
|
|
||||||
// typeName: tag => attributes, resource => resources
|
// typeName: tag => attributes, resource => resources
|
||||||
typeName := field.Type
|
typeName := field.Type
|
||||||
|
@ -719,3 +719,17 @@ func init() {
|
|||||||
const TRACE_V4_MAX_PAGINATION_LIMIT = 10000
|
const TRACE_V4_MAX_PAGINATION_LIMIT = 10000
|
||||||
|
|
||||||
const MaxResultRowsForCHQuery = 1_000_000
|
const MaxResultRowsForCHQuery = 1_000_000
|
||||||
|
|
||||||
|
var ChDataTypeMap = map[string]string{
|
||||||
|
"string": "String",
|
||||||
|
"bool": "Bool",
|
||||||
|
"int64": "Float64",
|
||||||
|
"float64": "Float64",
|
||||||
|
}
|
||||||
|
|
||||||
|
var MaterializedDataTypeMap = map[string]string{
|
||||||
|
"string": "string",
|
||||||
|
"bool": "bool",
|
||||||
|
"int64": "number",
|
||||||
|
"float64": "number",
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user