[SPARK-35282][SQL][FOLLOWUP] Simplify condition code of shuffled hash join
### What changes were proposed in this pull request? Simplify the condition code which is introduced by [SPARK-35282](https://issues.apache.org/jira/browse/SPARK-35282). ### Why are the changes needed? Reduce the code size and make code more readable. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Pass CI Closes #33046 from ulysses-you/simplify-shj. Authored-by: ulysses-you <ulyssesyou18@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
This commit is contained in:
parent
5e77ca8071
commit
ff9ba89dcb
|
@ -272,28 +272,16 @@ trait JoinSelectionHelper {
|
|||
val buildLeft = if (hintOnly) {
|
||||
hintToShuffleHashJoinLeft(hint)
|
||||
} else {
|
||||
if (hintToPreferShuffleHashJoinLeft(hint)) {
|
||||
true
|
||||
} else {
|
||||
if (!conf.preferSortMergeJoin) {
|
||||
canBuildLocalHashMapBySize(left, conf) && muchSmaller(left, right)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
hintToPreferShuffleHashJoinLeft(hint) ||
|
||||
(!conf.preferSortMergeJoin && canBuildLocalHashMapBySize(left, conf) &&
|
||||
muchSmaller(left, right))
|
||||
}
|
||||
val buildRight = if (hintOnly) {
|
||||
hintToShuffleHashJoinRight(hint)
|
||||
} else {
|
||||
if (hintToPreferShuffleHashJoinRight(hint)) {
|
||||
true
|
||||
} else {
|
||||
if (!conf.preferSortMergeJoin) {
|
||||
canBuildLocalHashMapBySize(right, conf) && muchSmaller(right, left)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
hintToPreferShuffleHashJoinRight(hint) ||
|
||||
(!conf.preferSortMergeJoin && canBuildLocalHashMapBySize(right, conf) &&
|
||||
muchSmaller(right, left))
|
||||
}
|
||||
getBuildSide(
|
||||
canBuildShuffledHashJoinLeft(joinType) && buildLeft,
|
||||
|
|
|
@ -45,11 +45,8 @@ object DynamicJoinSelection extends Rule[LogicalPlan] {
|
|||
val maxShuffledHashJoinLocalMapThreshold =
|
||||
conf.getConf(SQLConf.ADAPTIVE_MAX_SHUFFLE_HASH_JOIN_LOCAL_MAP_THRESHOLD)
|
||||
val advisoryPartitionSize = conf.getConf(SQLConf.ADVISORY_PARTITION_SIZE_IN_BYTES)
|
||||
if (advisoryPartitionSize <= maxShuffledHashJoinLocalMapThreshold) {
|
||||
advisoryPartitionSize <= maxShuffledHashJoinLocalMapThreshold &&
|
||||
mapStats.bytesByPartitionId.forall(_ <= maxShuffledHashJoinLocalMapThreshold)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private def selectJoinStrategy(plan: LogicalPlan): Option[JoinStrategyHint] = plan match {
|
||||
|
|
Loading…
Reference in a new issue