metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Casey Stella <ceste...@gmail.com>
Subject Re: [DISCUSS] Treating null as false in boolean expressions in Stellar
Date Sat, 16 Jun 2018 17:10:52 GMT
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 <cestella@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?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message