Skip to content

Commit

Permalink
feat: add other join types from the official Substrait
Browse files Browse the repository at this point in the history
  • Loading branch information
EpsilonPrime committed Aug 14, 2024
1 parent 18d9876 commit 6729158
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ message JoinRel {
JOIN_TYPE_LEFT = 3;
JOIN_TYPE_RIGHT = 4;
JOIN_TYPE_LEFT_SEMI = 5;
JOIN_TYPE_RIGHT_SEMI = 6;
JOIN_TYPE_ANTI = 7;
// This join is useful for nested sub-queries where we need exactly one tuple in output (or throw exception)
// See Section 3.2 of https://15721.courses.cs.cmu.edu/spring2018/papers/16-optimizer2/hyperjoins-btw2017.pdf
JOIN_TYPE_SINGLE = 8;
JOIN_TYPE_LEFT_ANTI = 6;
JOIN_TYPE_LEFT_SINGLE = 7;
JOIN_TYPE_RIGHT_SEMI = 8;
JOIN_TYPE_RIGHT_ANTI = 9;
JOIN_TYPE_RIGHT_SINGLE = 10;
}

substrait.extensions.AdvancedExtension advanced_extension = 10;
Expand All @@ -253,6 +253,7 @@ message CrossRel {

JoinType type = 5;

// TODO -- Remove this unnecessary type.
enum JoinType {
JOIN_TYPE_UNSPECIFIED = 0;
JOIN_TYPE_INNER = 1;
Expand Down Expand Up @@ -649,6 +650,8 @@ message HashJoinRel {
JOIN_TYPE_RIGHT_SEMI = 6;
JOIN_TYPE_LEFT_ANTI = 7;
JOIN_TYPE_RIGHT_ANTI = 8;
JOIN_TYPE_LEFT_SINGLE = 9;
JOIN_TYPE_RIGHT_SINGLE = 10;
}

substrait.extensions.AdvancedExtension advanced_extension = 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ abstract class SortMergeJoinExecTransformerBase(
case LeftSemi =>
JoinRel.JoinType.JOIN_TYPE_LEFT_SEMI
case LeftAnti =>
JoinRel.JoinType.JOIN_TYPE_ANTI
JoinRel.JoinType.JOIN_TYPE_LEFT_ANTI
case _ =>
// TODO: Support cross join with Cross Rel
// TODO: Support existence join
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object SubstraitUtil {
case LeftSemi =>
JoinRel.JoinType.JOIN_TYPE_LEFT_SEMI
case LeftAnti =>
JoinRel.JoinType.JOIN_TYPE_ANTI
JoinRel.JoinType.JOIN_TYPE_LEFT_ANTI
case _ =>
// TODO: Support existence join
JoinRel.JoinType.UNRECOGNIZED
Expand Down

0 comments on commit 6729158

Please sign in to comment.