quamina
quamina copied to clipboard
pat: Fix numeric matching
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:
{ "max": [ {"numeric": [ "=", 30] } ] }
But there might be a case for asking at the Match* API level to request canonicalizing numbers in incoming events.
In fact, the right thing to do here is to add the full suite of numeric pattern features from EventBridge.
In fact, the right thing to do here is to add the full suite of
numericpattern features from EventBridge.
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.