Skip to content

Implement a Rule to evaluate filter on top of constant Values #24371

Open
@raunaqmorarka

Description

@raunaqmorarka

Existing PushFilterIntoValues has a low default of 100.
The main reason was that it could get expensive to evaluate. Filtering is done by constant folding the predicate once for each row:

Optional<Expression> optimizedPredicate = newOptimizer(plannerContext).process(rewrittenPredicate, context.getSession(), ImmutableMap.of());

Also, if a single row prevents the optimization from being applied, it bails out. In some cases, it might try this over and over after other optimizations adjust the plan a bit, so the cost can compound.

A rule specialized for constant values can be more efficient and allow evaluation of filter over bigger Value row counts.

https://trinodb.slack.com/archives/CGB0QHWSW/p1733333833961729?thread_ts=1733322821.342029&cid=CGB0QHWSW

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions