Skip to content

Check FILTER dedup and FILTER/CASE IR equivalence from #467 #517

Description

@milindsrivastava1997

Follow-up to #467 (per-measure FILTER predicates on Aggregate, #466). These review questions were not answered before merge: #467 (review)

Questions

  1. When several aggregates share the same FILTER predicate, what happens? Do we deduplicate the filters?
  2. Do these equivalent queries lower to the same IR?
    • one aggregate with FILTER (WHERE p), e.g. SUM(x) FILTER (WHERE p)
    • one aggregate with the matching CASE, e.g. SUM(CASE WHEN p THEN x END)

Expected outcome

  • Write down the current behavior for both questions, with the IR for each case.
  • If the FILTER and CASE forms lower to different IR, add a canonicalization pass that gives them the same IR, reusing the canonicalization logic already in the codebase. Add a test that the two forms are equivalent.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions