Follow-up to #467 (per-measure FILTER predicates on Aggregate, #466). These review questions were not answered before merge: #467 (review)
Questions
- When several aggregates share the same
FILTER predicate, what happens? Do we deduplicate the filters?
- 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.
Follow-up to #467 (per-measure
FILTERpredicates onAggregate, #466). These review questions were not answered before merge: #467 (review)Questions
FILTERpredicate, what happens? Do we deduplicate the filters?FILTER (WHERE p), e.g.SUM(x) FILTER (WHERE p)CASE, e.g.SUM(CASE WHEN p THEN x END)Expected outcome
FILTERandCASEforms 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.