Skip to content

Refine merging aggs with filters #25873

@kaikalur

Description

@kaikalur

Right now we simply add all the conditions to the partial group by which maybe too much. Instead, under some conditions like - all filters are arith/relational deterministic expressions - we can just extract the variables used and add them to the partial group by and leave the rest alone. For example:

SUM(if(type=1, x)) AS sum_1,
SUM(if(type=2, x)) AS sum_2,
SUM(if(type=3, x)) AS sum_3,

here, it's best to add type to the partial group by and let the rest of the rewrite stay the same.

CC: @feilong-liu

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    🆕 Unprioritized

    Status

    🆕 Unprioritized

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions