Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve null handling in filter expressions #685

Merged
merged 5 commits into from
Jul 21, 2023
Merged

Commits on Jul 21, 2023

  1. test: add filter null cases

    Co-authored-by: berkaycanbc <berkay.can@camunda.com>
    Co-authored-by: Nicola Puppa <nicola.puppa@camunda.com>
    Co-authored-by: Nikola Koevski <nikola.koevski@camunda.com>
    Co-authored-by: Remco Westerhoud <remco@westerhoud.nl>
    5 people committed Jul 21, 2023
    Configuration menu
    Copy the full SHA
    046f67a View commit details
    Browse the repository at this point in the history
  2. fix: allow null in filter comparisons

    This allows us to use `null` in filters where `null` is compared to
    the item, or when the item is `null` explicitly.
    
    It does not yet help us deal with variables that are missing, as this
    produces an error.
    
    Co-authored-by: berkaycanbc <berkay.can@camunda.com>
    Co-authored-by: Nicola Puppa <nicola.puppa@camunda.com>
    Co-authored-by: Remco Westerhoud <remco@westerhoud.nl>
    
    Conflicts:
     src/main/scala/org/camunda/feel/impl/interpreter/FeelInterpreter.scala
    
    Resolution:
     we ignore the change on the other case (previously a ValError, now
     error). Instead, we use the change we proposed (ignore this entry and
     continue with the others).
    korthout committed Jul 21, 2023
    Configuration menu
    Copy the full SHA
    04c123a View commit details
    Browse the repository at this point in the history
  3. test: ignore unsupported null filter comparisons

    Since we don't yet support list expressions with missing variables as
    `null` values in that list, there is no reason to work on the filter
    expressions for those list expressions.
    
    Example, [1,2,x,4] should eventually evaluate to [1,2,null,4] but at
    this time we evaluate it to an error stating that the variable is
    missing. Testing that [1,2,x,4][item > 3] works correctly is therefore
    not yet possible.
    
    Co-authored-by: berkaycanbc <berkay.can@camunda.com>
    Co-authored-by: Nicola Puppa <nicola.puppa@camunda.com>
    Co-authored-by: Remco Westerhoud <remco@westerhoud.nl>
    4 people committed Jul 21, 2023
    Configuration menu
    Copy the full SHA
    29e913a View commit details
    Browse the repository at this point in the history
  4. test: no longer fail on incorrect filters

    When the filter doesn't (always) return a boolean or a number (to filter
    by index), then we no longer want to fail. Instead, we want to provide a
    list of all the elements that did match the filter expression.
    
    So, when the filter does not even evaluate to a boolean value, then we
    want to product an empty list.
    
    And, if the filter sometimes evaluates to a boolean value and sometimes
    doesn't, then we want a list of those values for which the filter did
    evaluate to the boolean `true`.
    
    As both these cases are very similar, it makes sense to combine them
    into a single test.
    
    Co-authored-by: berkaycanbc <berkay.can@camunda.com>
    Co-authored-by: Nicola Puppa <nicola.puppa@camunda.com>
    Co-authored-by: Remco Westerhoud <remco@westerhoud.nl>
    4 people committed Jul 21, 2023
    Configuration menu
    Copy the full SHA
    d51db48 View commit details
    Browse the repository at this point in the history
  5. test: split off exceptional cases

    These cases are actually quite different from each other. We can
    highlight this by splitting them off into separate tests.
    korthout committed Jul 21, 2023
    Configuration menu
    Copy the full SHA
    96aa1e9 View commit details
    Browse the repository at this point in the history