Skip to content

[Feature] (All) logical optimizers should optimize subqueries #2480

Closed

Description

@jon-chuang

Describe the solution you'd like
Logical optimizer only walks LogicalPlan node inputs. However, realistically, every optimizer should now also walk every subquery by matching on Filter(Filter { expr: conjunction(vec![.., InSubquery/Exists { subquery }, ..] } and optimize the subquery too.

One solution may be to declare subqueries as one of the inputs to the plan nodes...? However, this may "denormalize" certain things, so it may be better to add a helper function (based on e.g. visit/accept) that makes it easy for all optimizations to detect and walk subqueries.

Activity

  1. changed the title [-][Feature] Logical optimizer should walk subqueries[/-] [+][Feature] (All) logical optimizers should optimize subqueries[/+] on May 7, 2022
  2. LorrensP-2158466 commented on Mar 19, 2025

    @LorrensP-2158466
    Contributor

    I'm interested in applying for GSoC this year for this project idea which links the EPIC where this issue is mentioned in. Since I'm interested I thought about contributing again to Datafusion.

    Is there still work to be done on this or did this pr already implement it?

  3. alamb commented on Feb 19, 2026

    @alamb
    Contributor

    Is there still work to be done on this or did this #13066 already implement it?

    I agree I think this is already complete

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions