Skip to content

Commit

Permalink
Fix the test by adding the compatibility check to EnsureRequirements
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshRosen committed Aug 6, 2015
1 parent a1c12b9 commit 4f08278
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ private[sql] case class EnsureRequirements(sqlContext: SQLContext) extends Rule[
}
}

private def ensureChildNumPartitionsAgreementIfNecessary(operator: SparkPlan): SparkPlan = {
private def ensureChildPartitioningsAreCompatible(operator: SparkPlan): SparkPlan = {
if (operator.requiresChildPartitioningsToBeCompatible) {
if (operator.children.map(_.outputPartitioning.numPartitions).distinct.size > 1) {
if (!Partitioning.allCompatible(operator.children.map(_.outputPartitioning))) {
val newChildren = operator.children.zip(operator.requiredChildDistribution).map {
case (child, requiredDistribution) =>
val targetPartitioning = canonicalPartitioning(requiredDistribution)
Expand Down Expand Up @@ -271,6 +271,6 @@ private[sql] case class EnsureRequirements(sqlContext: SQLContext) extends Rule[

def apply(plan: SparkPlan): SparkPlan = plan.transformUp {
case operator: SparkPlan =>
ensureDistributionAndOrdering(ensureChildNumPartitionsAgreementIfNecessary(operator))
ensureDistributionAndOrdering(ensureChildPartitioningsAreCompatible(operator))
}
}

0 comments on commit 4f08278

Please sign in to comment.