-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Run filter-into-join rule early for subqueries and disable project-filter rule #15511
Conversation
sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java
Show resolved
Hide resolved
@@ -224,11 +224,16 @@ public CalciteRulesManager(final Set<ExtensionCalciteRuleProvider> extensionCalc | |||
public List<Program> programs(final PlannerContext plannerContext) | |||
{ | |||
// Program that pre-processes the tree before letting the full-on VolcanoPlanner loose. | |||
List<RelOptRule> hepRules = new ArrayList<RelOptRule>(REDUCTION_RULES); | |||
if (plannerContext.getJoinAlgorithm().requiresSubquery()) { | |||
hepRules.add(CoreRules.FILTER_INTO_JOIN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain the reasoning about why we want this for sortMerge
, but not for broadcast
join? (that's essentially what requiresSubquery
is checking)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a very usefull rule; and would be good to run it early for every plan - however it could even by itself could create ScanQuery
beneath Join
-s like these which is good; however based on the discussions in #9843 and #9773
...it might not be the best for Druid;
so I've decided to only enable it when also the FANCY_JOIN
rules are added - as those will pill in this rule anyway.
...ore/multi-stage-query/src/test/java/org/apache/druid/msq/test/CalciteSelectQueryMSQTest.java
Outdated
Show resolved
Hide resolved
@@ -84,14 +85,15 @@ public class CalciteRulesManager | |||
* those functions). | |||
* 3) {@link CoreRules#JOIN_COMMUTE}, {@link JoinPushThroughJoinRule#RIGHT}, {@link JoinPushThroughJoinRule#LEFT}, | |||
* and {@link CoreRules#FILTER_INTO_JOIN}, which are part of {@link #FANCY_JOIN_RULES}. | |||
* 4) {@link CoreRules#PROJECT_FILTER_TRANSPOSE} because PartialDruidQuery would like to have the Project on top of the Filter - | |||
* this rule could create a lot of non-usefull plans. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* this rule could create a lot of non-usefull plans. | |
* this rule could create a lot of non-useful plans that unnecessarily increase the planning time. |
Fixes #XXXX.
Description
Fixed the bug ...
Renamed the class ...
Added a forbidden-apis entry ...
Release note
Key changed/added classes in this PR
MyFoo
OurBar
TheirBaz
This PR has: