A join statement can contain join predicates and join filters.
Join predicates are evaluated during performing the join operation, while join filters are evaluated on the set of join results.
Let me consider an example join query as follows:
In this query, the join predicates and filters are as follows:
- Join predicates: n_nationkey = r_regionkey
- Join filters: r_regionkey is null
Currently, in query plans, join filters are handled as selection operators, while join predicates are maintained as member variables of join operators.
This approach makes the implementation simple, but difficult to find the selection operators corresponding to join operators because they are separately maintained.
This problem is critical when the logical plan optimizer optimizes the join order of a query statement that contains two or more joins each of that has join filters.
Join filters should be distinguished from selection filters, and maintained in the corresponding join operators. For this, we should add join filtlers to the join expression, the logical join node, and several physical join executors.