[CALCITE-6363] Introduce a rule to derive more filters from inner join …
https://issues.apache.org/jira/browse/CALCITE-6363
Quality Gate passed
Issues
9 New issues
0 Accepted issues
Measures
0 Security Hotspots
84.5% Coverage on New Code
0.0% Duplication on New Code
REALLY appreciate your review. @jamesstarr It's very helpful. I'll address these as soon as possible.
Hi all I tried to re-implement predicate derivation in a new commit. Compared with a formal PR, it is more like a POC now. Looking forward to your suggestions.
Why this change was been made
As I commented on https://issues.apache.org/jira/browse/CALCITE-6363, predicate inference is not available in VolcanoPlanner currently, so this PR tries to propose a temporary solution to help implement predicate inference.
Main changes
- Introduce a new method in RelOptUtil to implement predicate inference, which basically copies RelMdPredicates.JoinConditionBasedPredicateInference, but makes some simplifications as follows: 1.1 Because the predicate is passed directly from the join, rather than pulled up from the filter node after the predicate is pushed down, there is no need to convert RexInputRef 1.2 FilterJoinRule will classify the generated predicates, so the new method does not need to classify the predicates, and just returns the generated predicates directly
- Call this method in FilterJoinRule, just after simplifying Outer Joins
- Introduced a new configuration item in FilterJoinRule to determine whether to enable predicate inference, and turned it off by default
- Added some unit tests
Impact
- Predicate inference is turned off by default, so it has no impact on the current logic
- Applicable to Inner Join, Outer Join and Semi-Anti Join