-
Notifications
You must be signed in to change notification settings - Fork 23
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
pat: Fix numeric matching #27
Comments
In fact, the right thing to do here is to add the full suite of |
Agree. I'd argue any deviation from EB might cause trouble down the road bc I cannot simply reuse EB patterns in Quamina but would have to write custom parsers. |
Now that I'm starting to think about this, I note that whenever aws-ruler sees a rule like { "x": [ 1, 1.5 ] } It puts in matchers for both the exact strings |
Note that implementing this (semantics are supposed to exactly match Ruler's) led to filing a Ruler issue: aws/event-ruler#163 |
addresses #27 Signed-off-by: Tim Bray <[email protected]>
* pat: correct numeric matching addresses #27 Signed-off-by: Tim Bray <[email protected]> * back off from math/rand/v2 to math/rand for go 1.19 Signed-off-by: Tim Bray <[email protected]> * patch flaws revealed by concurrency_test.go Signed-off-by: Tim Bray <[email protected]> --------- Signed-off-by: Tim Bray <[email protected]>
Fixed in #330 |
Quamina doesn't know that "30", "3.0e1", and "30.000" are the same number. We already have code to canonicalize numbers with up to 18 digits of precision in the range +/- 10**9 so they can be matched by a DFA, but canonicalizing is runtime-expensive and if you know that all the numbers in your events are integers, purely wasteful.
I think the best way to fix this is to introduce a "numeric" predicate into patterns:
But there might be a case for asking at the
Match*
API level to request canonicalizing numbers in incoming events.The text was updated successfully, but these errors were encountered: