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

Fix CustomShuffleReader replacement when decimal types enabled #1685

Merged
merged 5 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -2610,7 +2610,7 @@ object GpuOverrides {
),
exec[CustomShuffleReaderExec](
"A wrapper of shuffle query stage",
ExecChecks(TypeSig.commonCudfTypes, TypeSig.all),
ExecChecks(TypeSig.commonCudfTypes + TypeSig.DECIMAL, TypeSig.all),
(exec, conf, p, r) =>
new SparkPlanMeta[CustomShuffleReaderExec](exec, conf, p, r) {
override def tagPlanForGpu(): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import org.apache.spark.sql.execution.joins.SortMergeJoinExec
import org.apache.spark.sql.functions.{col, when}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2021 copyrights

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.rapids.execution.{GpuCustomShuffleReaderExec, GpuShuffledHashJoinBase}
import org.apache.spark.sql.types.{DecimalType, IntegerType, StructField, StructType}

object AdaptiveQueryExecSuite {
val TEST_FILES_ROOT: File = TestUtils.getTempDir(this.getClass.getSimpleName)
Expand Down Expand Up @@ -272,6 +273,7 @@ class AdaptiveQueryExecSuite
val conf = new SparkConf()
.set(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key, "true")
.set(SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key, "-1")
.set(RapidsConf.DECIMAL_TYPE_ENABLED.key, "true")

withGpuSparkSession(spark => {
setupTestData(spark)
Expand Down Expand Up @@ -309,6 +311,7 @@ class AdaptiveQueryExecSuite
.set(SQLConf.ADVISORY_PARTITION_SIZE_IN_BYTES.key, "50")
// disable DemoteBroadcastHashJoin rule from removing BHJ due to empty partitions
.set(SQLConf.NON_EMPTY_PARTITION_RATIO_FOR_BROADCAST_JOIN.key, "0")
.set(RapidsConf.DECIMAL_TYPE_ENABLED.key, "true")

withGpuSparkSession(spark => {
setupTestData(spark)
Expand Down Expand Up @@ -340,6 +343,7 @@ class AdaptiveQueryExecSuite
.set(SQLConf.NON_EMPTY_PARTITION_RATIO_FOR_BROADCAST_JOIN.key, "0")
.set(SQLConf.SHUFFLE_PARTITIONS.key, "5")
.set(RapidsConf.ENABLE_CAST_STRING_TO_INTEGER.key, "true")
.set(RapidsConf.DECIMAL_TYPE_ENABLED.key, "true")

withGpuSparkSession(spark => {
setupTestData(spark)
Expand Down Expand Up @@ -468,10 +472,16 @@ class AdaptiveQueryExecSuite

/** Ported from org.apache.spark.sql.test.SQLTestData */
private def testData2(spark: SparkSession) {
import spark.implicits._
val df = Seq[(Int, Int)]((1, 1), (1, 2), (2, 1), (2, 2), (3, 1), (3, 2))
.toDF("a", "b")
.repartition(col("a"))
import scala.collection.JavaConverters._
val df = spark.createDataFrame(
List(
Row(1, BigDecimal(1)), Row(1, BigDecimal(2)), Row(2, BigDecimal(1)),
Row(2, BigDecimal(2)), Row(3, BigDecimal(1)), Row(3, BigDecimal(2))
).asJava,
StructType(Array(
StructField("a", IntegerType),
StructField("b", DecimalType(18, 0))))
).repartition(col("a"))
registerAsParquetTable(spark, df, "testData2")
}

Expand Down