Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ case class ResolvedHint(child: LogicalPlan, hints: HintInfo = HintInfo())
*/
case class JoinHint(leftHint: Option[HintInfo], rightHint: Option[HintInfo]) {

def isEmpty: Boolean = leftHint.isEmpty && rightHint.isEmpty

override def toString: String = {
Seq(
leftHint.map("leftHint=" + _),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,9 @@ case class ApplyColumnarRulesAndInsertTransitions(

def apply(plan: SparkPlan): SparkPlan = {
var preInsertPlan: SparkPlan = plan
columnarRules.foreach((r : ColumnarRule) =>
preInsertPlan = r.preColumnarTransitions(preInsertPlan))
columnarRules.foreach( r => preInsertPlan = r.preColumnarTransitions(preInsertPlan))
Copy link
Contributor

Choose a reason for hiding this comment

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

how is this related to JoinSelection?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just simplify the code.

var postInsertPlan = insertTransitions(preInsertPlan, outputsColumnar)
columnarRules.reverse.foreach((r : ColumnarRule) =>
postInsertPlan = r.postColumnarTransitions(postInsertPlan))
columnarRules.reverse.foreach( r => postInsertPlan = r.postColumnarTransitions(postInsertPlan))
postInsertPlan
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,15 @@ abstract class SparkStrategies extends QueryPlanner[SparkPlan] {
}
}

createBroadcastHashJoin(true)
.orElse { if (hintToSortMergeJoin(hint)) createSortMergeJoin() else None }
.orElse(createShuffleHashJoin(true))
.orElse { if (hintToShuffleReplicateNL(hint)) createCartesianProduct() else None }
.getOrElse(createJoinWithoutHint())
if (hint.isEmpty) {
createJoinWithoutHint()
Copy link
Contributor

Choose a reason for hiding this comment

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

this change LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do this in case logical.Join(left, right, joinType, condition, hint) ... as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

} else {
createBroadcastHashJoin(true)
.orElse { if (hintToSortMergeJoin(hint)) createSortMergeJoin() else None }
.orElse(createShuffleHashJoin(true))
.orElse { if (hintToShuffleReplicateNL(hint)) createCartesianProduct() else None }
.getOrElse(createJoinWithoutHint())
}

case j @ ExtractSingleColumnNullAwareAntiJoin(leftKeys, rightKeys) =>
Seq(joins.BroadcastHashJoinExec(leftKeys, rightKeys, LeftAnti, BuildRight,
Expand Down Expand Up @@ -339,10 +343,13 @@ abstract class SparkStrategies extends QueryPlanner[SparkPlan] {
}
}

createBroadcastNLJoin(hintToBroadcastLeft(hint), hintToBroadcastRight(hint))
.orElse { if (hintToShuffleReplicateNL(hint)) createCartesianProduct() else None }
.getOrElse(createJoinWithoutHint())

if (hint.isEmpty) {
createJoinWithoutHint()
} else {
createBroadcastNLJoin(hintToBroadcastLeft(hint), hintToBroadcastRight(hint))
.orElse { if (hintToShuffleReplicateNL(hint)) createCartesianProduct() else None }
.getOrElse(createJoinWithoutHint())
}

// --- Cases where this strategy does not apply ---------------------------------------------
case _ => Nil
Expand Down