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

Ensure we have parentheses for bin ops. #3251

Merged
merged 1 commit into from
Jan 28, 2021

Conversation

cyriltovena
Copy link
Contributor

This ensure we correctly keep the order of execution when we stringify a bin operation.
This has recently introduced a bug because we now use stringify to deep clone a LogQL expression.

Signed-off-by: Cyril Tovena cyril.tovena@gmail.com

This ensure we correctly keep the order of execution when we stringify a bin operation.
This has recently introduced a bug because we now use stringify to deep clone a LogQL expression.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
}
return fmt.Sprintf("%s %s %s", e.SampleExpr.String(), e.op, e.RHS.String())
return fmt.Sprintf("(%s %s %s)", e.SampleExpr.String(), e.op, e.RHS.String())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the actual fix.

Copy link
Collaborator

@slim-bean slim-bean left a comment

Choose a reason for hiding this comment

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

LGTM!

@cyriltovena cyriltovena merged commit 1a36874 into grafana:master Jan 28, 2021
cyriltovena added a commit that referenced this pull request Jan 28, 2021
This ensure we correctly keep the order of execution when we stringify a bin operation.
This has recently introduced a bug because we now use stringify to deep clone a LogQL expression.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants