Skip to content

Revert avoid unnecessary parentheses change#72

Merged
makasim merged 2 commits intomasterfrom
revert-avoid-unnecessary-parentheses
Apr 22, 2026
Merged

Revert avoid unnecessary parentheses change#72
makasim merged 2 commits intomasterfrom
revert-avoid-unnecessary-parentheses

Conversation

@makasim
Copy link
Copy Markdown
Member

@makasim makasim commented Apr 21, 2026

The change introduced in #63 breaks query like this:

10 - (3 + 3 + 4)

which is transformed into:

10 - 3 + 3 + 4

Those queries produce different results.

Fixes VictoriaMetrics/VictoriaMetrics#10856


Summary by cubic

Reverts the optimization that removed parentheses in binary expressions to restore correct evaluation order. Prevents wrong rewrites like 10 - (3 + 3 + 4) → 10 - 3 + 3 + 4 (fixes VictoriaMetrics/VictoriaMetrics#10856).

  • Bug Fixes
    • Parser now always adds parentheses around binary operands; removed priority-based elision logic.
    • Updated tests and examples to expect preserved grouping (e.g., (a * b) / c and 100 * (x / y)).

Written for commit 4121a48. Summary will update on new commits.

@makasim makasim requested a review from f41gh7 April 21, 2026 16:54
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.73%. Comparing base (278b8a2) to head (4121a48).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #72      +/-   ##
==========================================
+ Coverage   89.71%   89.73%   +0.01%     
==========================================
  Files          11       11              
  Lines        2996     2981      -15     
==========================================
- Hits         2688     2675      -13     
+ Misses        210      209       -1     
+ Partials       98       97       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@makasim makasim self-assigned this Apr 21, 2026
Copy link
Copy Markdown
Contributor

@f41gh7 f41gh7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@makasim makasim merged commit cc09923 into master Apr 22, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Arithmetic operation error?

2 participants