-
Notifications
You must be signed in to change notification settings - Fork 0
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
Parse escalation condition #42
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The combination of filter evaluation and error handling can result in some strange behavior. Take incident_age>=InvalidDurationLiteral
as an example. This will be evaluated as EvalExists("incident_age") && !EvalLess("incident_age", "InvalidDurationLiteral")
. Here, EvalLess
will encounter an error and return false, making the overall expression return true.
Two options for addressing that:
- Make all the evaluation return
(bool, error)
. - After parsing, go over all conditions contained in it, and verify that if column is
incident_age
, the value must be a valid duration literal and if the column isincident_severity
, the value must be a valid severity name. That would remove the possibility of an invalid literal showing up during evaluation.
29ed3e2
to
f0b3d88
Compare
I think it would be better to pass an error through the whole filter evaluation, i.e. also add |
So what would happen in that case? I don't get it. This expression would be parsed as |
In the current implementation, this means it is handled just like a valid expression that was false. (Which means with a negation somewhere, this can become true again)
I'd expect that if any sub-expression was invalid, i.e. returned an error, the whole filter evaluation returns an error. When handling the overall filter, this will probably be handled similar to a return value, but with an additional "you're doing something broken here" log message. |
09ea1f0
to
727a27f
Compare
fbe46d0
to
650269f
Compare
650269f
to
170106a
Compare
170106a
to
9355ba5
Compare
@yhabteab Please have a look at the changes I added on top. |
4119344 🤦 |
Is that supposed to say that I can merge this PR? 😅 |
fixes #34