Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in config to avoid AST in some join cases #10553

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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 @@ -64,7 +64,11 @@ class GpuShuffledHashJoinMeta(

override def convertToGpu(): GpuExec = {
val condition = conditionMeta.map(_.convertToGpu())
val (joinCondition, filterCondition) = if (conditionMeta.forall(_.canThisBeAst)) {
val preferAst = join.joinType match {
case _: InnerLike => conf.preferAstJoin
case _ => true
}
val (joinCondition, filterCondition) = if (preferAst && conditionMeta.forall(_.canThisBeAst)) {
(condition, None)
} else {
(None, condition)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.nvidia.spark.rapids

import org.apache.spark.sql.catalyst.plans.{FullOuter, Inner}
import org.apache.spark.sql.catalyst.plans.{FullOuter, Inner, InnerLike}
import org.apache.spark.sql.execution.SortExec
import org.apache.spark.sql.execution.joins.SortMergeJoinExec
import org.apache.spark.sql.rapids.execution.{GpuHashJoin, JoinTypeChecks}
Expand Down Expand Up @@ -76,7 +76,11 @@ class GpuSortMergeJoinMeta(

override def convertToGpu(): GpuExec = {
val condition = conditionMeta.map(_.convertToGpu())
val (joinCondition, filterCondition) = if (conditionMeta.forall(_.canThisBeAst)) {
val preferAst = join.joinType match {
case _: InnerLike => conf.preferAstJoin
case _ => true
}
val (joinCondition, filterCondition) = if (preferAst && conditionMeta.forall(_.canThisBeAst)) {
(condition, None)
} else {
(None, condition)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,12 @@ val GPU_COREDUMP_PIPE_PATTERN = conf("spark.rapids.gpu.coreDump.pipePattern")
.booleanConf
.createWithDefault(true)

val PREFER_AST_JOIN = conf("spark.rapids.sql.join.preferAst")
.doc("Prefer the use of AST for non-equality portions of a join")
.internal()
.booleanConf
.createWithDefault(true)

val STABLE_SORT = conf("spark.rapids.sql.stableSort.enabled")
.doc("Enable or disable stable sorting. Apache Spark's sorting is typically a stable " +
"sort, but sort stability cannot be guaranteed in distributed work loads because the " +
Expand Down Expand Up @@ -2334,6 +2340,8 @@ class RapidsConf(conf: Map[String, String]) extends Logging {

lazy val useShuffledSymmetricHashJoin: Boolean = get(USE_SHUFFLED_SYMMETRIC_HASH_JOIN)

lazy val preferAstJoin: Boolean = get(PREFER_AST_JOIN)

lazy val stableSort: Boolean = get(STABLE_SORT)

lazy val isFileScanPrunePartitionEnabled: Boolean = get(FILE_SCAN_PRUNE_PARTITION_ENABLED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@
{"spark": "332cdh"}
{"spark": "333"}
{"spark": "334"}
{"spark": "340"}
{"spark": "341"}
{"spark": "342"}
{"spark": "350"}
{"spark": "351"}
spark-rapids-shim-json-lines ***/
package org.apache.spark.sql.rapids.execution

import com.nvidia.spark.rapids._

import org.apache.spark.sql.catalyst.expressions.Expression
import org.apache.spark.sql.catalyst.plans.JoinType
import org.apache.spark.sql.catalyst.plans.{InnerLike, JoinType}
import org.apache.spark.sql.execution.SparkPlan
import org.apache.spark.sql.execution.joins.BroadcastHashJoinExec

Expand All @@ -49,7 +54,11 @@ class GpuBroadcastHashJoinMeta(

override def convertToGpu(): GpuExec = {
val condition = conditionMeta.map(_.convertToGpu())
val (joinCondition, filterCondition) = if (conditionMeta.forall(_.canThisBeAst)) {
val preferAst = join.joinType match {
case _: InnerLike => conf.preferAstJoin
case _ => true
}
val (joinCondition, filterCondition) = if (preferAst && conditionMeta.forall(_.canThisBeAst)) {
(condition, None)
} else {
(None, condition)
Expand Down Expand Up @@ -82,4 +91,4 @@ case class GpuBroadcastHashJoinExec(
override val condition: Option[Expression],
left: SparkPlan,
right: SparkPlan) extends GpuBroadcastHashJoinExecBase(
leftKeys, rightKeys, joinType, buildSide, condition, left, right)
leftKeys, rightKeys, joinType, buildSide, condition, left, right)
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import org.apache.spark.TaskContext
import org.apache.spark.rapids.shims.GpuShuffleExchangeExec
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.catalyst.expressions.{Attribute, Expression}
import org.apache.spark.sql.catalyst.plans.JoinType
import org.apache.spark.sql.catalyst.plans.{InnerLike, JoinType}
import org.apache.spark.sql.catalyst.plans.physical.{BroadcastDistribution, Distribution, UnspecifiedDistribution}
import org.apache.spark.sql.execution.{CoalescedPartitionSpec, SparkPlan}
import org.apache.spark.sql.execution.adaptive.ShuffleQueryStageExec
Expand All @@ -46,7 +46,11 @@ class GpuBroadcastHashJoinMeta(

override def convertToGpu(): GpuExec = {
val condition = conditionMeta.map(_.convertToGpu())
val (joinCondition, filterCondition) = if (conditionMeta.forall(_.canThisBeAst)) {
val preferAst = join.joinType match {
case _: InnerLike => conf.preferAstJoin
case _ => true
}
val (joinCondition, filterCondition) = if (preferAst && conditionMeta.forall(_.canThisBeAst)) {
(condition, None)
} else {
(None, condition)
Expand Down

This file was deleted.

Loading