Skip to content
Closed
Prev Previous commit
Next Next commit
upstream changes
  • Loading branch information
sameeragarwal committed Jan 29, 2016
commit 8c6bb702e90346ec3189857c70e8579d431bb91c
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ case class Filter(condition: Expression, child: LogicalPlan) extends UnaryNode {
}

abstract class SetOperation(left: LogicalPlan, right: LogicalPlan) extends BinaryNode {
final override lazy val resolved: Boolean =
childrenResolved &&
left.output.length == right.output.length &&
left.output.zip(right.output).forall { case (l, r) => l.dataType == r.dataType }

override def getRelevantConstraints(child: QueryPlan[LogicalPlan]): Set[Expression] = {
child.constraints.filter(_.references.subsetOf(child.outputSet))
Expand Down Expand Up @@ -135,13 +131,26 @@ case class Intersect(left: LogicalPlan, right: LogicalPlan) extends SetOperation
override protected def validConstraints: Set[Expression] = {
leftConstraints.union(rightConstraints)
}

// Intersect are only resolved if they don't introduce ambiguous expression ids,
// since the Optimizer will convert Intersect to Join.
override lazy val resolved: Boolean =
childrenResolved &&
left.output.length == right.output.length &&
left.output.zip(right.output).forall { case (l, r) => l.dataType == r.dataType } &&
duplicateResolved
}

case class Except(left: LogicalPlan, right: LogicalPlan) extends SetOperation(left, right) {
/** We don't use right.output because those rows get excluded from the set. */
override def output: Seq[Attribute] = left.output

override protected def validConstraints: Set[Expression] = leftConstraints

override lazy val resolved: Boolean =
childrenResolved &&
left.output.length == right.output.length &&
left.output.zip(right.output).forall { case (l, r) => l.dataType == r.dataType }
}

/** Factory for constructing new `Union` nodes. */
Expand Down Expand Up @@ -269,6 +278,8 @@ case class Join(

def selfJoinResolved: Boolean = left.outputSet.intersect(right.outputSet).isEmpty
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was a merging mistake as its duplicated with the method below.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, fixed!


def duplicateResolved: Boolean = left.outputSet.intersect(right.outputSet).isEmpty

// Joins are only resolved if they don't introduce ambiguous expression ids.
override lazy val resolved: Boolean = {
childrenResolved &&
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.