Closed zxcvf closed 1 year ago
` switch m.Type { case prompb.LabelMatcher_EQ, prompb.LabelMatcher_NEQ:
case prompb.LabelMatcher_RE, prompb.LabelMatcher_NRE:
var tagFormat string
var val string
// BUG here, prompb.LabelMatcher_EQ should be prompb.LabelMatcher_RE
if m.Type == prompb.LabelMatcher_EQ {
tagFormat = ` AND arrayExists(x -> 1 == match(x, '^%s=%s'),tags) = 1 `
} else {
tagFormat = ` AND arrayExists(x -> 1 == match(x, '^%s=%s'),tags) = 0 `
}
if strings.HasPrefix(m.Value, "^") {
val = strings.Replace(m.Value, "^", "", 1)
}
val = strings.Replace(val, `/`, `\/`, -1)
str := fmt.Sprintf(tagFormat, m.Name, val)
s.sqlStr.WriteString(str)
}
`
update clickhouse/query.go