Skip to content

ES|QL: Adapt PushDownFilterAndLimitIntoUnionAll for FORK #137886

@ioanatia

Description

@ioanatia

Subqueries have a neat optimization in PushDownFilterAndLimitIntoUnionAll where we pushdown filters and limit to subqueries.

For example:

     * Filter (pushable predicates)
     *   UnionAll
     *     Project
     *       Eval (optional)
     *         Limit
     *           EsRelation
     *      Project
     *        Eval (optional)
     *          Limit
     *            Subquery

becomes:

     *  UnionAll
     *    Project
     *      Eval (optional)
     *        Limit
     *          Filter (pushable predicates)
     *            EsRelation
     *     Project
     *       Eval (optional)
     *         Limit
     *           Filter (pushable predicates)
     *             Subquery

There's no reason not to make this generic so that it applies for FORK too.
There's one aspect with the attributes being pushdown past the implicit LIMIT, that can make the results of FORK different. However we want to remove this implicit LIMIT, so we should be good with adding this optimization for FORK too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions