metron-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (METRON-379) Stellar - No Error When Adding Variables That Do Not Exist
Date Thu, 03 Aug 2017 13:52:00 GMT


ASF GitHub Bot commented on METRON-379:

Github user cestella commented on the issue:
    In my opinion, I don't think we want this behavior.  I think it may be too severe given
how dirty and sparse our data tends to be.
    Does this mean that if you have a stellar expression `FOO(bar)` and the field `bar` doesn't
exist, will we get an exception?  If so, given that messages come through with certain fields
which are optional (i.e. some messages have field `foo` and others might not have a field
`foo` depending on the parser), I think this will result in a fair number of errors.
    I'd rather leave it up to the Stellar function creator to figure out if the field is able
to be optional or not rather than having a blanket policy of throwing an exception.  Consider
the function `TO_UPPER`.  I'd rather `TO_UPPER` tolerate missing fields by passing them through
(i.e. `TO_UPPER(null) == null`) rather than throw an exception.
    One approach to this would be changing the `StellarFunction` interface to a `List<Optional<Object>>`
instead of a `List<Object>` and have the variability made explicit.

> Stellar - No Error When Adding Variables That Do Not Exist
> ----------------------------------------------------------
>                 Key: METRON-379
>                 URL:
>             Project: Metron
>          Issue Type: Bug
>    Affects Versions: 0.2.1BETA
>            Reporter: Nick Allen
>            Assignee: Otto Fowler
>              Labels: stellar
> Running a Stellar expression like "1 + var + does + not + exist" results in a value of
1.0.  I would expect an exception or error condition.
> {|borderStyle=solid}
>   @Test(expected = ParseException.class)
>   public void testMissingVariables() {
>     String query = "1 + cannot + add + missing + variables";
>     run(query, new HashMap<>());
>   }
> {code}

This message was sent by Atlassian JIRA

View raw message