-
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.
Add Apache Spark 3.3.1-SNAPSHOT Shims (#5877)
* Add shims for spark 3.3.1-SNAPSHOT Signed-off-by: Anthony Chang <antchang@nvidia.com> * Add spark 3.3.1 shim test suite Signed-off-by: Anthony Chang <antchang@nvidia.com> * Fix some version definitions Signed-off-by: Anthony Chang <antchang@nvidia.com> * Factor out common 330 and 331 shims to 330until340
- Loading branch information
1 parent
84bf4ba
commit 9802304
Showing
12 changed files
with
255 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,7 @@ case $DIST_PROFILE in | |
320 | ||
321 | ||
322 | ||
331 | ||
) | ||
;; | ||
|
||
|
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
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
sql-plugin/src/main/331/scala/com/nvidia/spark/rapids/SparkShims.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,23 @@ | ||
/* | ||
* 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 | ||
|
||
import com.nvidia.spark.rapids._ | ||
|
||
object SparkShimImpl extends Spark330PlusShims with Spark320until340Shims { | ||
override def getSparkShimVersion: ShimVersion = ShimLoader.getShimVersion | ||
} |
33 changes: 33 additions & 0 deletions
33
.../src/main/331/scala/com/nvidia/spark/rapids/shims/spark331/SparkShimServiceProvider.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,33 @@ | ||
/* | ||
* 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.spark331 | ||
|
||
import com.nvidia.spark.rapids.SparkShimVersion | ||
|
||
object SparkShimServiceProvider { | ||
val VERSION = SparkShimVersion(3, 3, 1) | ||
val VERSIONNAMES = Seq(s"$VERSION", s"$VERSION-SNAPSHOT") | ||
} | ||
|
||
class SparkShimServiceProvider extends com.nvidia.spark.rapids.SparkShimServiceProvider { | ||
|
||
override def getShimVersion: SparkShimVersion = SparkShimServiceProvider.VERSION | ||
|
||
def matchesVersion(version: String): Boolean = { | ||
SparkShimServiceProvider.VERSIONNAMES.contains(version) | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
sql-plugin/src/main/331/scala/com/nvidia/spark/rapids/spark331/RapidsShuffleManager.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,26 @@ | ||
/* | ||
* 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.spark331 | ||
|
||
import org.apache.spark.SparkConf | ||
import org.apache.spark.sql.rapids.shims.spark331.ProxyRapidsShuffleInternalManager | ||
|
||
/** A shuffle manager optimized for the RAPIDS Plugin for Apache Spark. */ | ||
sealed class RapidsShuffleManager( | ||
conf: SparkConf, | ||
isDriver: Boolean) extends ProxyRapidsShuffleInternalManager(conf, isDriver) { | ||
} |
60 changes: 60 additions & 0 deletions
60
...n/331/scala/org/apache/spark/sql/rapids/shims/spark331/RapidsShuffleInternalManager.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,60 @@ | ||
/* | ||
* 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 org.apache.spark.sql.rapids.shims.spark331 | ||
|
||
import org.apache.spark.{SparkConf, TaskContext} | ||
import org.apache.spark.shuffle._ | ||
import org.apache.spark.sql.rapids.{ProxyRapidsShuffleInternalManagerBase, RapidsShuffleInternalManagerBase} | ||
|
||
/** | ||
* A shuffle manager optimized for the RAPIDS Plugin For Apache Spark. | ||
* @note This is an internal class to obtain access to the private | ||
* `ShuffleManager` and `SortShuffleManager` classes. | ||
*/ | ||
class RapidsShuffleInternalManager(conf: SparkConf, isDriver: Boolean) | ||
extends RapidsShuffleInternalManagerBase(conf, isDriver) { | ||
|
||
def getReader[K, C]( | ||
handle: ShuffleHandle, | ||
startMapIndex: Int, | ||
endMapIndex: Int, | ||
startPartition: Int, | ||
endPartition: Int, | ||
context: TaskContext, | ||
metrics: ShuffleReadMetricsReporter): ShuffleReader[K, C] = { | ||
getReaderInternal(handle, startMapIndex, endMapIndex, startPartition, endPartition, context, | ||
metrics) | ||
} | ||
} | ||
|
||
|
||
class ProxyRapidsShuffleInternalManager(conf: SparkConf, isDriver: Boolean) | ||
extends ProxyRapidsShuffleInternalManagerBase(conf, isDriver) with ShuffleManager { | ||
|
||
def getReader[K, C]( | ||
handle: ShuffleHandle, | ||
startMapIndex: Int, | ||
endMapIndex: Int, | ||
startPartition: Int, | ||
endPartition: Int, | ||
context: TaskContext, | ||
metrics: ShuffleReadMetricsReporter | ||
): ShuffleReader[K, C] = { | ||
self.getReader(handle, startMapIndex, endMapIndex, startPartition, endPartition, context, | ||
metrics) | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...plugin/src/test/331/scala/com/nvidia/spark/rapids/shims/spark331/Spark331ShimsSuite.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,41 @@ | ||
/* | ||
* 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.spark331; | ||
|
||
import com.nvidia.spark.rapids.{ShimLoader, SparkShimVersion, TypeSig} | ||
import com.nvidia.spark.rapids.shims.SparkShimImpl | ||
import org.scalatest.FunSuite | ||
|
||
import org.apache.spark.sql.types.{DayTimeIntervalType, YearMonthIntervalType} | ||
|
||
class Spark331ShimsSuite extends FunSuite { | ||
test("spark shims version") { | ||
assert(SparkShimImpl.getSparkShimVersion === SparkShimVersion(3, 3, 1)) | ||
} | ||
|
||
test("shuffle manager class") { | ||
assert(ShimLoader.getRapidsShuffleManagerClass === | ||
classOf[com.nvidia.spark.rapids.spark331.RapidsShuffleManager].getCanonicalName) | ||
} | ||
|
||
test("TypeSig331") { | ||
val check = TypeSig.DAYTIME + TypeSig.YEARMONTH | ||
assert(check.isSupportedByPlugin(DayTimeIntervalType()) == true) | ||
assert(check.isSupportedByPlugin(YearMonthIntervalType()) == true) | ||
} | ||
|
||
} |