-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Support For Various Execs for Databricks 13.3 (#9637)
* PartitionedFileUtilShim use SparkPath instead of a path string * Changed DB method * ParquetCVShim change * ShuffleRDD method change * FileSinkDesc moved * changed params to wrap * moved to 341db to honor shimplify convention of a file being in the oldest supported version * added GpuAppendDataExecV1 to 341db * Refactored GpuShuffleExchangeExec and ParquetCVShims * Refactored FilePartitionShims * Refactored GpuBroadcastHashJoinExec and GpuBroadcastNestedLoopJoinExec * removed unused imports * Signing off Signed-off-by: Raza Jafri <rjafri@nvidia.com> * Fixed DB build * Fixed test_multi_table_hash_join test failure * addressed review comments --------- Signed-off-by: Raza Jafri <rjafri@nvidia.com>
- Loading branch information
Showing
18 changed files
with
385 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
.../src/main/spark321db/scala/org/apache/spark/rapids/shims/GpuShuffleExchangeExecBase.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright (c) 2022-2023, 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. | ||
*/ | ||
/*** spark-rapids-shim-json-lines | ||
{"spark": "321db"} | ||
{"spark": "330db"} | ||
{"spark": "332db"} | ||
{"spark": "341db"} | ||
spark-rapids-shim-json-lines ***/ | ||
package org.apache.spark.rapids.shims | ||
|
||
import com.nvidia.spark.rapids.GpuPartitioning | ||
|
||
import org.apache.spark.rdd.RDD | ||
import org.apache.spark.sql.catalyst.plans.logical.Statistics | ||
import org.apache.spark.sql.catalyst.plans.physical.Partitioning | ||
import org.apache.spark.sql.execution.{ShufflePartitionSpec, SparkPlan} | ||
import org.apache.spark.sql.execution.exchange.{ShuffleExchangeLike, ShuffleOrigin} | ||
import org.apache.spark.sql.rapids.execution.{GpuShuffleExchangeExecBaseWithMetrics, ShuffledBatchRDD} | ||
|
||
abstract class GpuDatabricksShuffleExchangeExecBase( | ||
gpuOutputPartitioning: GpuPartitioning, | ||
child: SparkPlan, | ||
shuffleOrigin: ShuffleOrigin)( | ||
cpuOutputPartitioning: Partitioning) | ||
extends GpuShuffleExchangeExecBaseWithMetrics(gpuOutputPartitioning, child) | ||
with ShuffleExchangeLike { | ||
|
||
override def otherCopyArgs: Seq[AnyRef] = cpuOutputPartitioning :: Nil | ||
|
||
override val outputPartitioning: Partitioning = cpuOutputPartitioning | ||
|
||
override def numMappers: Int = shuffleDependencyColumnar.rdd.getNumPartitions | ||
|
||
override def numPartitions: Int = shuffleDependencyColumnar.partitioner.numPartitions | ||
|
||
override def getShuffleRDD(partitionSpecs: Array[ShufflePartitionSpec]): RDD[_] = { | ||
new ShuffledBatchRDD(shuffleDependencyColumnar, metrics ++ readMetrics, partitionSpecs) | ||
} | ||
|
||
// DB SPECIFIC - throw if called since we don't know how its used | ||
override def withNewOutputPartitioning(outputPartitioning: Partitioning) = { | ||
throw new UnsupportedOperationException | ||
} | ||
|
||
override def runtimeStatistics: Statistics = { | ||
// note that Spark will only use the sizeInBytes statistic but making the rowCount | ||
// available here means that we can more easily reference it in GpuOverrides when | ||
// planning future query stages when AQE is on | ||
Statistics( | ||
sizeInBytes = metrics("dataSize").value, | ||
rowCount = Some(metrics("numOutputRows").value) | ||
) | ||
} | ||
|
||
override def shuffleId: Int = shuffleDependencyColumnar.shuffleId | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...src/main/spark330db/scala/org/apache/spark/sql/rapids/execution/ShuffleExchangeShim.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) 2023, 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. | ||
*/ | ||
|
||
/*** spark-rapids-shim-json-lines | ||
{"spark": "330db"} | ||
{"spark": "332db"} | ||
spark-rapids-shim-json-lines ***/ | ||
package org.apache.spark.sql.rapids.execution | ||
|
||
import org.apache.spark.rapids.shims.GpuShuffleExchangeExec | ||
import org.apache.spark.rdd.RDD | ||
import org.apache.spark.sql.execution.CoalescedPartitionSpec | ||
import org.apache.spark.sql.vectorized.ColumnarBatch | ||
|
||
object ShuffleExchangeShim { | ||
def getShuffleRDD( | ||
shuffleExchange: GpuShuffleExchangeExec, | ||
partitionSpecs: Seq[CoalescedPartitionSpec]): RDD[ColumnarBatch] = { | ||
shuffleExchange.getShuffleRDD(partitionSpecs.toArray) | ||
.asInstanceOf[RDD[ColumnarBatch]] | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...in/src/main/spark341db/scala/com/nvidia/spark/rapids/shims/PartitionedFileUtilsShim.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2023, 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. | ||
*/ | ||
|
||
/*** spark-rapids-shim-json-lines | ||
{"spark": "341db"} | ||
spark-rapids-shim-json-lines ***/ | ||
package com.nvidia.spark.rapids.shims | ||
|
||
import org.apache.spark.paths.SparkPath | ||
import org.apache.spark.sql.catalyst.InternalRow | ||
import org.apache.spark.sql.execution.datasources.PartitionedFile | ||
|
||
object PartitionedFileUtilsShim { | ||
// Wrapper for case class constructor so Java code can access | ||
// the default values across Spark versions. | ||
def newPartitionedFile( | ||
partitionValues: InternalRow, | ||
filePath: String, | ||
start: Long, | ||
length: Long): PartitionedFile = { | ||
PartitionedFile(partitionValues, SparkPath.fromPathString(filePath), start, length) | ||
} | ||
|
||
def withNewLocations(pf: PartitionedFile, locations: Seq[String]): PartitionedFile = { | ||
pf.copy(locations = locations) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.