Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.16.0
-
None
-
None
Description
There is necessary to add logic to derive additional filters from for FilterJoinRule in the case of using disjunction of expressions:
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rel/rules/FilterJoinRule.java#L155
The example query is:
select * from sales.emp e join sales.dept d on e.job = d.name where (e.deptno = 5 AND d.deptno = 2) OR (e.deptno = 7 AND d.deptno = 3)
The filrer condition in DNF
LogicalFilter(condition=[OR(AND(=($7, 5), =($9, 2)), AND(=($7, 7), =($9, 3)))])
can be transformed into CNF and then the ncessary filters can be pushed down:
LogicalFilter(condition=[OR(=($7, 5), =($7, 7))]) and LogicalFilter(condition=[OR(=($9, 2), =($9, 3))])
Additional filter still will be present on top of join.
Finally deriving additional filters can allow to scan less information.
Attachments
Issue Links
- is required by
-
DRILL-6379 Pushing additional filters for disjunction of expressions past JOIN
- Open
- relates to
-
CALCITE-2241 Join equality condition should be considered while pushing down filter conditions with expressions disjunction for both tables
- Open
-
DRILL-6350 Umbrella jira which tracks issues connected to Transitive Closure Inference
- Open