Skip to content

Commit

Permalink
document MINUS_MULTISET and INTERSECTION_PRIMARY
Browse files Browse the repository at this point in the history
  • Loading branch information
kadinrabo committed Oct 4, 2024
1 parent f9c61fe commit 3a25e3b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions core/src/main/java/io/substrait/relation/Set.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
public abstract class Set extends AbstractRel implements HasExtension {
public abstract Set.SetOp getSetOp();

// MINUS_MULTISET and INTERSECTION_PRIMARY are set to be removed (substrait-io/substrait/pull/708)
public static enum SetOp {
UNKNOWN(SetRel.SetOp.SET_OP_UNSPECIFIED),
MINUS_PRIMARY(SetRel.SetOp.SET_OP_MINUS_PRIMARY),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ public RelNode visit(Set set) throws RuntimeException {
input -> {
relBuilder.push(input.accept(this));
});
// MINUS_MULTISET and INTERSECTION_PRIMARY are set to be removed
// (substrait-io/substrait/pull/708)
var builder =
switch (set.getSetOp()) {
case MINUS_PRIMARY -> relBuilder.minus(false, numInputs);
Expand Down
13 changes: 9 additions & 4 deletions isthmus/src/test/java/io/substrait/isthmus/utils/SetUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public static String getSetQuery(Set.SetOp op, boolean multi) {
String opString =
switch (op) {
case MINUS_PRIMARY -> "EXCEPT";
case MINUS_PRIMARY_ALL, MINUS_MULTISET -> "EXCEPT ALL";
case INTERSECTION_PRIMARY, INTERSECTION_MULTISET -> "INTERSECT";
case MINUS_PRIMARY_ALL -> "EXCEPT ALL";
case INTERSECTION_MULTISET -> "INTERSECT";
case INTERSECTION_MULTISET_ALL -> "INTERSECT ALL";
case UNION_DISTINCT -> "UNION";
case UNION_ALL -> "UNION ALL";
case UNKNOWN -> throw new UnsupportedOperationException(
default -> throw new UnsupportedOperationException(
"Unknown set operation is not supported");
};

Expand All @@ -50,9 +50,14 @@ public static String getSetQuery(Set.SetOp op, boolean multi) {
}

// Generate all combinations excluding the UNKNOWN operator
// MINUS_MULTISET and INTERSECTION_PRIMARY are set to be removed (substrait-io/substrait/pull/708)
public static Stream<Arguments> setTestConfig() {
return Arrays.stream(Set.SetOp.values())
.filter(op -> op != Set.SetOp.UNKNOWN)
.filter(
op ->
op != Set.SetOp.UNKNOWN
&& op != Set.SetOp.MINUS_MULTISET
&& op != Set.SetOp.INTERSECTION_PRIMARY)
.flatMap(op -> Stream.of(arguments(op, false), arguments(op, true)));
}
}

0 comments on commit 3a25e3b

Please sign in to comment.