Add check that cross join does not have pruned or reordered output symbols
@@ -19,14 +19,12 @@ import com.facebook.presto.sql.tree.Join;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
import javax.annotation.concurrent.Immutable;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
-import java.util.Set;
import java.util.stream.Stream;
import static com.facebook.presto.sql.planner.plan.JoinNode.Type.INNER;
@@ -74,12 +72,6 @@ public class JoinNode
requireNonNull(leftHashSymbol, "leftHashSymbol is null");
requireNonNull(rightHashSymbol, "rightHashSymbol is null");
- Set<Symbol> inputSymbols = ImmutableSet.<Symbol>builder()
- .addAll(left.getOutputSymbols())
- .addAll(right.getOutputSymbols())
- .build();
- checkArgument(inputSymbols.containsAll(outputSymbols), "Left and right join inputs do not contain all output symbols");
-
this.type = type;
this.left = left;
this.right = right;
@@ -88,6 +80,13 @@ public class JoinNode
this.filter = filter;
this.leftHashSymbol = leftHashSymbol;
this.rightHashSymbol = rightHashSymbol;
+
+ List<Symbol> inputSymbols = ImmutableList.<Symbol>builder()
+ .addAll(left.getOutputSymbols())
+ .addAll(right.getOutputSymbols())
+ .build();
+ checkArgument(inputSymbols.containsAll(outputSymbols), "Left and right join inputs do not contain all output symbols");
+ checkArgument(!isCrossJoin() || inputSymbols.equals(outputSymbols), "Cross join does not support output symbols pruning or reordering");
}
public enum Type
