@@ -43,15 +43,15 @@ object CostBasedJoinReorder extends Rule[LogicalPlan] with PredicateHelper {
4343 val result = plan transformDown {
4444 // Start reordering with a joinable item, which is an InnerLike join with conditions.
4545 // Avoid reordering if a join hint is present.
46- case j @ Join (_, _, _ : InnerLike , Some (cond), hint) if hint == JoinHint .NONE =>
46+ case j @ Join (_, _, _ : InnerLike , Some (cond), JoinHint .NONE ) =>
4747 reorder(j, j.output)
48- case p @ Project (projectList, Join (_, _, _ : InnerLike , Some (cond), hint ))
49- if projectList.forall(_.isInstanceOf [Attribute ]) && hint == JoinHint . NONE =>
48+ case p @ Project (projectList, Join (_, _, _ : InnerLike , Some (cond), JoinHint . NONE ))
49+ if projectList.forall(_.isInstanceOf [Attribute ]) =>
5050 reorder(p, p.output)
5151 }
5252 // After reordering is finished, convert OrderedJoin back to Join.
5353 result transform {
54- case OrderedJoin (left, right, jt, cond, hint ) => Join (left, right, jt, cond, hint )
54+ case OrderedJoin (left, right, jt, cond) => Join (left, right, jt, cond, JoinHint . NONE )
5555 }
5656 }
5757 }
@@ -77,25 +77,25 @@ object CostBasedJoinReorder extends Rule[LogicalPlan] with PredicateHelper {
7777 */
7878 private def extractInnerJoins (plan : LogicalPlan ): (Seq [LogicalPlan ], Set [Expression ]) = {
7979 plan match {
80- case Join (left, right, _ : InnerLike , Some (cond), hint) if hint == JoinHint .NONE =>
80+ case Join (left, right, _ : InnerLike , Some (cond), JoinHint .NONE ) =>
8181 val (leftPlans, leftConditions) = extractInnerJoins(left)
8282 val (rightPlans, rightConditions) = extractInnerJoins(right)
8383 (leftPlans ++ rightPlans, splitConjunctivePredicates(cond).toSet ++
8484 leftConditions ++ rightConditions)
85- case Project (projectList, j @ Join (_, _, _ : InnerLike , Some (cond), hint ))
86- if projectList.forall(_.isInstanceOf [Attribute ]) && hint == JoinHint . NONE =>
85+ case Project (projectList, j @ Join (_, _, _ : InnerLike , Some (cond), JoinHint . NONE ))
86+ if projectList.forall(_.isInstanceOf [Attribute ]) =>
8787 extractInnerJoins(j)
8888 case _ =>
8989 (Seq (plan), Set ())
9090 }
9191 }
9292
9393 private def replaceWithOrderedJoin (plan : LogicalPlan ): LogicalPlan = plan match {
94- case j @ Join (left, right, jt : InnerLike , Some (cond), hint ) =>
94+ case j @ Join (left, right, jt : InnerLike , Some (cond), JoinHint . NONE ) =>
9595 val replacedLeft = replaceWithOrderedJoin(left)
9696 val replacedRight = replaceWithOrderedJoin(right)
97- OrderedJoin (replacedLeft, replacedRight, jt, Some (cond), hint )
98- case p @ Project (projectList, j @ Join (_, _, _ : InnerLike , Some (cond), _ )) =>
97+ OrderedJoin (replacedLeft, replacedRight, jt, Some (cond))
98+ case p @ Project (projectList, j @ Join (_, _, _ : InnerLike , Some (cond), JoinHint . NONE )) =>
9999 p.copy(child = replaceWithOrderedJoin(j))
100100 case _ =>
101101 plan
@@ -107,8 +107,7 @@ case class OrderedJoin(
107107 left : LogicalPlan ,
108108 right : LogicalPlan ,
109109 joinType : JoinType ,
110- condition : Option [Expression ],
111- hint : JoinHint ) extends BinaryNode {
110+ condition : Option [Expression ]) extends BinaryNode {
112111 override def output : Seq [Attribute ] = left.output ++ right.output
113112}
114113
0 commit comments