I created a PR for the empty collection falseyness as well: https://github.com/apache/metron/pull/1064 so we can choose either of them if we so desire.
On Sat, Jun 16, 2018 at 1:10 PM Casey Stella <ceste...@gmail.com> wrote: > I created a PR for this functionality, in case we decided for it: > https://github.com/apache/metron/pull/1063 > > Also, while we're talking, perhaps we should treat empty lists as false as > well, like javascript and python. > So, for instance, if [] then 'blah' else 'foo' would return foo. > > Thoughts? > > On Sat, Jun 16, 2018 at 10:17 AM Casey Stella <ceste...@gmail.com> wrote: > >> Right now, because fields may not exist, users can have an awkward time. >> For instance, checking for is_alert, you end up having to preface checks >> with exists(is_alert). >> >> For instance, in one of our use-cases: >> https://github.com/apache/metron/tree/master/use-cases/geographic_login_outliers >> we use >> >> "is_alert := exists(is_alert) && is_alert", >> "is_alert := is_alert || (geo_outlier != null && geo_outlier == true)", >> >> instead of : >> >> "is_alert := is_alert || geo_outlier == true", >> >> I suggest that we adopt a convention from javascript whereby we assume a >> field not existing or being null should act as false in boolean >> expressions. This will simplify stellar's use and hopefully result in less >> awkwardness. >> >> Thoughts? >> >