diff --git a/app/vmselect/promql/exec_test.go b/app/vmselect/promql/exec_test.go index c61861cec..18bec093f 100644 --- a/app/vmselect/promql/exec_test.go +++ b/app/vmselect/promql/exec_test.go @@ -868,12 +868,23 @@ func TestExecSuccess(t *testing.T) { resultExpected := []netstorage.Result{r} f(q, resultExpected) }) - t.Run("time()*-1^0.5", func(t *testing.T) { + t.Run("time()*(-4)^0.5", func(t *testing.T) { t.Parallel() - q := `time()*-1^0.5` + q := `time()*(-4)^0.5` resultExpected := []netstorage.Result{} f(q, resultExpected) }) + t.Run("time()*-4^0.5", func(t *testing.T) { + t.Parallel() + q := `time()*-4^0.5` + r := netstorage.Result{ + MetricName: metricNameExpected, + Values: []float64{-2000, -2400, -2800, -3200, -3600, -4000}, + Timestamps: timestampsExpected, + } + resultExpected := []netstorage.Result{r} + f(q, resultExpected) + }) t.Run(`alias()`, func(t *testing.T) { t.Parallel() q := `alias(time(), "foobar")` diff --git a/go.mod b/go.mod index 33c65acc6..c6cf084c1 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( // like https://github.com/valyala/fasthttp/commit/996610f021ff45fdc98c2ce7884d5fa4e7f9199b github.com/VictoriaMetrics/fasthttp v1.0.4 github.com/VictoriaMetrics/metrics v1.12.2 - github.com/VictoriaMetrics/metricsql v0.4.0 + github.com/VictoriaMetrics/metricsql v0.4.1 github.com/aws/aws-sdk-go v1.33.19 github.com/cespare/xxhash/v2 v2.1.1 github.com/golang/snappy v0.0.1 diff --git a/go.sum b/go.sum index 2ba24cf94..07a077c17 100644 --- a/go.sum +++ b/go.sum @@ -51,8 +51,8 @@ github.com/VictoriaMetrics/fasthttp v1.0.4 h1:Aw6UqmPc0v5PunYOpiiyf4hk5B9PTMswdT github.com/VictoriaMetrics/fasthttp v1.0.4/go.mod h1:m5wCmg1dJN6s1B/lp8/dcKrnnM2l3DWB2eAGZGCTK3g= github.com/VictoriaMetrics/metrics v1.12.2 h1:SG8iAmqavDNuh7GIdHPoGHUhDL23KeKfvSZSozucNeA= github.com/VictoriaMetrics/metrics v1.12.2/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY3u88J12hSoOhuiRE= -github.com/VictoriaMetrics/metricsql v0.4.0 h1:1CMGiUzOgR83Y+hVS83/DaHYLaR6PFw1XWcvQnHn2V8= -github.com/VictoriaMetrics/metricsql v0.4.0/go.mod h1:ylO7YITho/Iw6P71oEaGyHbO94bGoGtzWfLGqFhMIg8= +github.com/VictoriaMetrics/metricsql v0.4.1 h1:WbVIfRNCK7HjrzayrpAl07mkh4kiDFZuECsh57rly2Q= +github.com/VictoriaMetrics/metricsql v0.4.1/go.mod h1:ylO7YITho/Iw6P71oEaGyHbO94bGoGtzWfLGqFhMIg8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= diff --git a/vendor/github.com/VictoriaMetrics/metricsql/parser.go b/vendor/github.com/VictoriaMetrics/metricsql/parser.go index 309f5fb04..315186469 100644 --- a/vendor/github.com/VictoriaMetrics/metricsql/parser.go +++ b/vendor/github.com/VictoriaMetrics/metricsql/parser.go @@ -399,7 +399,7 @@ func (p *parser) parseSingleExprWithoutRollupSuffix() (Expr, error) { case "{": return p.parseMetricExpr() case "-": - // Unary minus. Substitute -expr with (0 - expr) + // Unary minus. Substitute `-expr` with `0 - expr` if err := p.lex.Next(); err != nil { return nil, err } @@ -414,8 +414,7 @@ func (p *parser) parseSingleExprWithoutRollupSuffix() (Expr, error) { }, Right: e, } - pe := parensExpr{be} - return &pe, nil + return be, nil case "+": // Unary plus if err := p.lex.Next(); err != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index fd0a3f3e6..bca31537b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -16,7 +16,7 @@ github.com/VictoriaMetrics/fasthttp/fasthttputil github.com/VictoriaMetrics/fasthttp/stackless # github.com/VictoriaMetrics/metrics v1.12.2 github.com/VictoriaMetrics/metrics -# github.com/VictoriaMetrics/metricsql v0.4.0 +# github.com/VictoriaMetrics/metricsql v0.4.1 github.com/VictoriaMetrics/metricsql github.com/VictoriaMetrics/metricsql/binaryop # github.com/aws/aws-sdk-go v1.33.19