forked from VictoriaMetrics/metricsql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aggr.go
59 lines (55 loc) · 1.17 KB
/
aggr.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package metricsql
import (
"strings"
)
var aggrFuncs = map[string]bool{
"any": true,
"avg": true,
"bottomk": true,
"bottomk_avg": true,
"bottomk_max": true,
"bottomk_median": true,
"bottomk_last": true,
"bottomk_min": true,
"count": true,
"count_values": true,
"distinct": true,
"geomean": true,
"group": true,
"histogram": true,
"limitk": true,
"mad": true,
"max": true,
"median": true,
"min": true,
"mode": true,
"outliers_mad": true,
"outliersk": true,
"quantile": true,
"quantiles": true,
"share": true,
"stddev": true,
"stdvar": true,
"sum": true,
"sum2": true,
"topk": true,
"topk_avg": true,
"topk_max": true,
"topk_median": true,
"topk_last": true,
"topk_min": true,
"zscore": true,
}
func isAggrFunc(s string) bool {
s = strings.ToLower(s)
return aggrFuncs[s]
}
func isAggrFuncModifier(s string) bool {
s = strings.ToLower(s)
switch s {
case "by", "without":
return true
default:
return false
}
}