vendor: update github.com/VictoriaMetrics/metricsql from v0.70.0 to v0.70.1

This should help with the https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5604
This commit is contained in:
Aliaksandr Valialkin 2024-02-06 21:52:32 +02:00
parent 891a9f9511
commit ae1b09e953
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB
6 changed files with 40 additions and 9 deletions

View file

@ -11,6 +11,8 @@ The following `tip` changes can be tested by building VictoriaMetrics components
## v1.93.x long-time support release (LTS)
* BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly propagate [label filters](https://docs.victoriametrics.com/keyconcepts/#filtering) from multiple arguments passed to [aggregate functions](https://docs.victoriametrics.com/metricsql/#aggregate-functions). For example, `sum({job="foo"}, {job="bar"}) by (job) + a` was improperly optimized to `sum({job="foo"}, {job="bar"}) by (job) + a{job="foo"}` before being executed. This could lead to unexpected results. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5604).
## [v1.93.11](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.93.11)
Released at 2024-02-01

2
go.mod
View file

@ -12,7 +12,7 @@ require (
// like https://github.com/valyala/fasthttp/commit/996610f021ff45fdc98c2ce7884d5fa4e7f9199b
github.com/VictoriaMetrics/fasthttp v1.2.0
github.com/VictoriaMetrics/metrics v1.31.0
github.com/VictoriaMetrics/metricsql v0.70.0
github.com/VictoriaMetrics/metricsql v0.70.1
github.com/aws/aws-sdk-go-v2 v1.24.1
github.com/aws/aws-sdk-go-v2/config v1.26.6
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.15.15

4
go.sum
View file

@ -66,8 +66,8 @@ github.com/VictoriaMetrics/fasthttp v1.2.0/go.mod h1:zv5YSmasAoSyv8sBVexfArzFDIG
github.com/VictoriaMetrics/metrics v1.24.0/go.mod h1:eFT25kvsTidQFHb6U0oa0rTrDRdz4xTYjpL8+UPohys=
github.com/VictoriaMetrics/metrics v1.31.0 h1:X6+nBvAP0UB+GjR0Ht9hhQ3pjL1AN4b8dt9zFfzTsUo=
github.com/VictoriaMetrics/metrics v1.31.0/go.mod h1:r7hveu6xMdUACXvB8TYdAj8WEsKzWB0EkpJN+RDtOf8=
github.com/VictoriaMetrics/metricsql v0.70.0 h1:G0k/m1yAF6pmk0dM3VT9/XI5PZ8dL7EbcLhREf4bgeI=
github.com/VictoriaMetrics/metricsql v0.70.0/go.mod h1:k4UaP/+CjuZslIjd+kCigNG9TQmUqh5v0TP/nMEy90I=
github.com/VictoriaMetrics/metricsql v0.70.1 h1:9WneeSk9HAGf9E8qZmuPnE3KaflBpVkrLjpPtbAlzoU=
github.com/VictoriaMetrics/metricsql v0.70.1/go.mod h1:k4UaP/+CjuZslIjd+kCigNG9TQmUqh5v0TP/nMEy90I=
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=

View file

@ -88,7 +88,16 @@ func getCommonLabelFilters(e Expr) []LabelFilter {
}
return getCommonLabelFilters(arg)
case *AggrFuncExpr:
arg := getFuncArgForOptimization(t.Name, t.Args)
args := t.Args
if len(args) > 0 && canAcceptMultipleArgsForAggrFunc(t.Name) {
lfs := getCommonLabelFilters(args[0])
for _, arg := range args[1:] {
lfsNext := getCommonLabelFilters(arg)
lfs = intersectLabelFilters(lfs, lfsNext)
}
return trimFiltersByAggrModifier(lfs, t)
}
arg := getFuncArgForOptimization(t.Name, args)
if arg == nil {
return nil
}
@ -242,9 +251,16 @@ func pushdownBinaryOpFiltersInplace(e Expr, lfs []LabelFilter) {
}
case *AggrFuncExpr:
lfs = trimFiltersByAggrModifier(lfs, t)
arg := getFuncArgForOptimization(t.Name, t.Args)
if arg != nil {
pushdownBinaryOpFiltersInplace(arg, lfs)
args := t.Args
if len(args) > 0 && canAcceptMultipleArgsForAggrFunc(t.Name) {
for _, arg := range args {
pushdownBinaryOpFiltersInplace(arg, lfs)
}
} else {
arg := getFuncArgForOptimization(t.Name, args)
if arg != nil {
pushdownBinaryOpFiltersInplace(arg, lfs)
}
}
case *BinaryOpExpr:
lfs = TrimFiltersByGroupModifier(lfs, t)
@ -379,10 +395,23 @@ func getAggrArgIdxForOptimization(funcName string, args []Expr) int {
case "quantiles":
return len(args) - 1
default:
if len(args) > 1 && canAcceptMultipleArgsForAggrFunc(funcName) {
panic(fmt.Errorf("BUG: %d > 1 args passed to aggregate function %q; this case must be already handled", len(args), funcName))
}
return 0
}
}
func canAcceptMultipleArgsForAggrFunc(funcName string) bool {
switch strings.ToLower(funcName) {
case "any", "avg", "count", "distinct", "geomean", "group", "histogram", "mad", "max",
"median", "min", "mode", "share", "stddev", "stdvar", "sum", "sum2", "zscore":
return true
default:
return false
}
}
func getRollupArgIdxForOptimization(funcName string, args []Expr) int {
// This must be kept in sync with GetRollupArgIdx()
switch strings.ToLower(funcName) {

View file

@ -24,9 +24,9 @@ var transformFuncs = map[string]bool{
"clamp_min": true,
"cos": true,
"cosh": true,
"day_of_year": true,
"day_of_month": true,
"day_of_week": true,
"day_of_year": true,
"days_in_month": true,
"deg": true,
"drop_common_labels": true,

2
vendor/modules.txt vendored
View file

@ -104,7 +104,7 @@ github.com/VictoriaMetrics/fasthttp/stackless
# github.com/VictoriaMetrics/metrics v1.31.0
## explicit; go 1.17
github.com/VictoriaMetrics/metrics
# github.com/VictoriaMetrics/metricsql v0.70.0
# github.com/VictoriaMetrics/metricsql v0.70.1
## explicit; go 1.13
github.com/VictoriaMetrics/metricsql
github.com/VictoriaMetrics/metricsql/binaryop