Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle Expr::Binary properly in walk_expr #89

Merged
merged 5 commits into from
Jul 10, 2024

Conversation

scintillavoy
Copy link
Contributor

When handling Expr::Binary in walk_expr, the return values from lhs and rhs are ORed (||) but it should be &&.

For example, let the expression be foo{l1="v1"} + bar{l2="v2"}. walk_expr will recurse into lhs (foo) first and if the return value is Ok(true), it should recurse into rhs (bar) but it would not.

Additionally, there was a small inconsistency in the example (newlines between the output), so I fixed it.

Copy link

codecov bot commented Jul 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.99%. Comparing base (6e46e66) to head (36fc304).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #89   +/-   ##
=======================================
  Coverage   98.99%   98.99%           
=======================================
  Files          14       14           
  Lines        6272     6296   +24     
=======================================
+ Hits         6209     6233   +24     
  Misses         63       63           

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

waynexia
waynexia previously approved these changes Jul 10, 2024
Copy link
Member

@waynexia waynexia left a comment

Choose a reason for hiding this comment

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

Looking great! Thanks for this fixing.

This PR is good enough for merging. It would be better if you are willing to add a unit test to reflect this change!

Copy link
Contributor

@evenyag evenyag left a comment

Choose a reason for hiding this comment

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

Thanks! Could you please fix the clippy warning?

@scintillavoy
Copy link
Contributor Author

@waynexia

Looking great! Thanks for this fixing.

This PR is good enough for merging. It would be better if you are willing to add a unit test to reflect this change!

I added some tests, but I'm new to Rust so please check if I organized the code correctly. 😅

@scintillavoy
Copy link
Contributor Author

@evenyag

Thanks! Could you please fix the clippy warning?

I checked it, but I have no idea how to fix it. The message says there are possible "refactorings" in the file promql.y.rs and it seems it is not introduced by the changes from this PR.

@waynexia waynexia enabled auto-merge (squash) July 10, 2024 08:31
@waynexia waynexia merged commit a561f2c into GreptimeTeam:main Jul 10, 2024
5 checks passed
@waynexia
Copy link
Member

Thank you @scintillavoy ❤️

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.

3 participants