quamina icon indicating copy to clipboard operation
quamina copied to clipboard

pat: Fix numeric matching

Open timbray opened this issue 3 years ago • 4 comments

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.

timbray avatar May 27 '22 20:05 timbray

In fact, the right thing to do here is to add the full suite of numeric pattern features from EventBridge.

timbray avatar Jun 04 '22 23:06 timbray

In fact, the right thing to do here is to add the full suite of numeric pattern 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.

embano1 avatar Jun 20 '22 20:06 embano1