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
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.
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.