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

Unshim join execs [databricks] #4416

Merged
merged 4 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.nvidia.spark.rapids.shims.v2

import com.nvidia.spark.rapids.{GpuBuildLeft, GpuBuildRight, GpuBuildSide}

import org.apache.spark.sql.catalyst.optimizer.{BuildLeft, BuildRight, BuildSide}

object GpuJoinUtils {
def getGpuBuildSide(buildSide: BuildSide): GpuBuildSide = {
buildSide match {
case BuildRight => GpuBuildRight
case BuildLeft => GpuBuildLeft
case _ => throw new Exception(s"unknown build side type $buildSide")
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder
import org.apache.spark.sql.catalyst.errors.attachTree
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.catalyst.expressions.aggregate.Average
import org.apache.spark.sql.catalyst.plans.JoinType
import org.apache.spark.sql.catalyst.plans.physical.{BroadcastMode, Partitioning}
import org.apache.spark.sql.catalyst.trees.TreeNode
import org.apache.spark.sql.connector.read.Scan
Expand All @@ -54,12 +53,11 @@ import org.apache.spark.sql.execution.datasources.rapids.GpuPartitioningUtils
import org.apache.spark.sql.execution.datasources.v2.orc.OrcScan
import org.apache.spark.sql.execution.datasources.v2.parquet.ParquetScan
import org.apache.spark.sql.execution.exchange.{ReusedExchangeExec, ShuffleExchangeExec}
import org.apache.spark.sql.execution.joins._
import org.apache.spark.sql.execution.python._
import org.apache.spark.sql.execution.window.WindowExecBase
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.rapids.{GpuAbs, GpuAverage, GpuFileSourceScanExec, GpuTimeSub}
import org.apache.spark.sql.rapids.execution.{GpuBroadcastNestedLoopJoinExecBase, GpuShuffleExchangeExecBase, JoinTypeChecks, SerializeBatchDeserializeHostBuffer, SerializeConcatHostBuffersDeserializeBatch, TrampolineUtil}
import org.apache.spark.sql.rapids.execution.{GpuShuffleExchangeExecBase, SerializeBatchDeserializeHostBuffer, SerializeConcatHostBuffersDeserializeBatch, TrampolineUtil}
import org.apache.spark.sql.rapids.execution.python._
import org.apache.spark.sql.rapids.execution.python.shims.v2._
import org.apache.spark.sql.rapids.shims.v2.{GpuFileScanRDD, GpuSchemaUtils}
Expand Down Expand Up @@ -111,16 +109,6 @@ abstract class Spark30XdbShims extends Spark30XdbShimsBase with Logging {
startMapIndex, endMapIndex, startPartition, endPartition)
}

override def getGpuBroadcastNestedLoopJoinShim(
left: SparkPlan,
right: SparkPlan,
join: BroadcastNestedLoopJoinExec,
joinType: JoinType,
condition: Option[Expression],
targetSizeBytes: Long): GpuBroadcastNestedLoopJoinExecBase = {
GpuBroadcastNestedLoopJoinExec(left, right, join, joinType, condition, targetSizeBytes)
}

override def getGpuShuffleExchangeExec(
gpuOutputPartitioning: GpuPartitioning,
child: SparkPlan,
Expand All @@ -136,20 +124,6 @@ abstract class Spark30XdbShims extends Spark30XdbShimsBase with Logging {
queryStage.shuffle.asInstanceOf[GpuShuffleExchangeExecBase]
}

override def isGpuBroadcastHashJoin(plan: SparkPlan): Boolean = {
plan match {
case _: GpuBroadcastHashJoinExec => true
case _ => false
}
}

override def isGpuShuffledHashJoin(plan: SparkPlan): Boolean = {
plan match {
case _: GpuShuffledHashJoinExec => true
case _ => false
}
}

override def getExecs: Map[Class[_ <: SparkPlan], ExecRule[_ <: SparkPlan]] = {
Seq(
GpuOverrides.exec[RunningWindowFunctionExec](
Expand Down Expand Up @@ -260,18 +234,6 @@ abstract class Spark30XdbShims extends Spark30XdbShimsBase with Logging {
)(winPy.partitionSpec)
}
}).disabledByDefault("it only supports row based frame for now"),
GpuOverrides.exec[SortMergeJoinExec](
"Sort merge join, replacing with shuffled hash join",
JoinTypeChecks.equiJoinExecChecks,
(join, conf, p, r) => new GpuSortMergeJoinMeta(join, conf, p, r)),
GpuOverrides.exec[BroadcastHashJoinExec](
"Implementation of join using broadcast data",
JoinTypeChecks.equiJoinExecChecks,
(join, conf, p, r) => new GpuBroadcastHashJoinMeta(join, conf, p, r)),
GpuOverrides.exec[ShuffledHashJoinExec](
"Implementation of join using hashed shuffled data",
JoinTypeChecks.equiJoinExecChecks,
(join, conf, p, r) => new GpuShuffledHashJoinMeta(join, conf, p, r)),
GpuOverrides.exec[ArrowEvalPythonExec](
"The backend of the Scalar Pandas UDFs. Accelerates the data transfer between the" +
" Java process and the Python process. It also supports scheduling GPU resources" +
Expand Down Expand Up @@ -457,14 +419,6 @@ abstract class Spark30XdbShims extends Spark30XdbShimsBase with Logging {
})
).map(r => (r.getClassFor.asSubclass(classOf[Scan]), r)).toMap

override def getBuildSide(join: HashJoin): GpuBuildSide = {
GpuJoinUtils.getGpuBuildSide(join.buildSide)
}

override def getBuildSide(join: BroadcastNestedLoopJoinExec): GpuBuildSide = {
GpuJoinUtils.getGpuBuildSide(join.buildSide)
}

override def getPartitionFileNames(
partitions: Seq[PartitionDirectory]): Seq[String] = {
val files = partitions.flatMap(partition => partition.files)
Expand Down
Loading