-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] (All) logical optimizers should optimize subqueries #2480
Labels
enhancement
New feature or request
Comments
eejbyfeldt
added a commit
to eejbyfeldt/datafusion
that referenced
this issue
Oct 22, 2024
This patch makes it so that rules the configure an `apply_order` will also include subqueries in their traversel. This is a step twoards being able to run TPC-DS q41 (apache#4763) which has an expressions that needs simplification before we can decorrelate the subquery. This closes apache#3770 and maybe apache#2480
eejbyfeldt
added a commit
to eejbyfeldt/datafusion
that referenced
this issue
Oct 22, 2024
This patch makes it so that rules the configure an `apply_order` will also include subqueries in their traversel. This is a step twoards being able to run TPC-DS q41 (apache#4763) which has an expressions that needs simplification before we can decorrelate the subquery. This closes apache#3770 and maybe apache#2480
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The text was updated successfully, but these errors were encountered: