Victoriametrics: Incorrect unary operator precedence

Created on 6 Aug 2020  路  4Comments  路  Source: VictoriaMetrics/VictoriaMetrics

Describe the bug
Unary operator precedence does not seem to match native PromQL.

To Reproduce
Run the query -1^2. It returns -1 in Prometheus, but 1 in VictoriaMetrics, since unary and power operator precedence seem to be inverted relative to native PromQL.

Expected behavior
^ should have higher precedence than unary -.

Version

$ ./victoria-metrics-prod --version
victoria-metrics-20200727-204526-tags-v1.39.1-0-g5b81bdde3
bug

Most helpful comment

Note that, at the time this was implemented here, this was correct PromQL behavior, which changed with https://github.com/prometheus/prometheus/issues/6575.

All 4 comments

Note that, at the time this was implemented here, this was correct PromQL behavior, which changed with https://github.com/prometheus/prometheus/issues/6575.

@juliusv , thanks for the bug report! The issue should be fixed in the commit 716754fae6a9bd2effa2e357e52e5655f8516df5 , which will be included in the next release of VictoriaMetrics.

@slrtbtfs Ah, thanks for the background! Wasn't aware of that.

The bugfix has been included in v1.39.4. Closing this issue as fixed.

Was this page helpful?
0 / 5 - 0 ratings