Skip to content

Commit

Permalink
[WIP] rowexec: paired joiners to accomplish left joins
Browse files Browse the repository at this point in the history
The paired joiners are used to accomplish left {outer,semi,anti}
joins when the first joiner will produce false positives (as
known to the optimizer).
Currently, only the invertedJoiner can function as this first
joiner but there is wording in the spec describing how this
could also be useful for join expressions that can't be fully
evaluated on one non-inverted index.

The first joiner outputs an additional bool column representing
a continuation value. This is used to demarcate groups of
consecutive rows output by the first joiner that represent
the same original left row. The first joiner needs to preserve
input row order (the invertedJoiner always does this). The
second joiner is a lookup join and handles these groups in
a special manner. The second join does not need to be order
preserving.

Informs cockroachdb#53576

Prior to this, the way to do:
- a left outer join with an inverted join is to
  do an inner join with the same ON condition, which is a pair
  of inverted join and lookup join, and then wrap the expression
  in another left join with the original left side.
- a left anti join with an inverted join is to map it to a left
  outer join (previous bullet).
- a left semi join is to map it to an inner join with the same
  ON condition, which is a pair of inverted join and lookup
  join, and then project, sort (or make the lookup join order
  preserving) and dedup.
We expect that the alternative outlined in this PR (it excludes
the optimizer changes) will be more efficient since it is
simply a pairing of inverted joiner and lookup join (and the
latter does not need to be order preserving).

Release note: None
  • Loading branch information
sumeerbhola committed Sep 22, 2020
1 parent 77751ac commit f105bea
Show file tree
Hide file tree
Showing 5 changed files with 643 additions and 222 deletions.
Loading

0 comments on commit f105bea

Please sign in to comment.