Ruben Quesada Lopez created CALCITE-2968:
--------------------------------------------
Summary: New AntiJoin relational expression
Key: CALCITE-2968
URL: https://issues.apache.org/jira/browse/CALCITE-2968
Project: Calcite
Issue Type: New Feature
Reporter: Ruben Quesada Lopez
The goal of this ticket is to follow the discussion started in CALCITE-2920
(and its [PR|https://github.com/apache/calcite/pull/1110]).
With the implementation of CALCITE-2920, RelBuilder has now a method to create
an AntiJoin. However, since, for the moment, there is no "AntiJoin" expression,
the only possibility to build an AntiJoin is using a LogicalCorrelate with
SemiJoinType.ANTI, and that's exactly what this method does, for now.
The idea would be to "generalize" this with the creation of a new AntiJoin
(a.k.a. AntiSemiJoin) relational expression.
Some ideas about how to implement it:
- Modify SemiJoin class: add a new instance field protected final SemiJoinType
semiJoinType;, which will be by default SemiJoinType.SEMI (to ensure backwards
compatibility); but that could also be SemiJoinType.ANTI, to represent an
AntiJoin (a.k.a. AntiSemiJoin)
- We could easily have two implementations of Antijoin:
-- a) Enumerable: small modification in EnumerableSemiJoin and
EnumerableSemiJoinRule in order to propagate the SemiJoinType, plus a new
antiJoin method in EnumerableDefaults (basically the same as semiJoin method,
but with a "not contains" predicate instead of "contains")
-- b) Correlate: small modification in JoinToCorrelateRule to propagate the
SemiJoin.semiJoinType will suffice to create the appropriate LogicalCorrelate
with type SEMI / ANTI
- RelBuilder antiJoin method would no longer create a LogicalCorrelate
type=ANTI, but instead a SemiJoin type=ANTI (using a new method in
SemiJoinFactory that would accept an additional SemiJoinType parameter).
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)