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

Skip the test for spark versions 3.1.1, 3.1.2 and 3.2.0 only [databricks] #4491

Merged
merged 3 commits into from
Jan 11, 2022
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
11 changes: 8 additions & 3 deletions integration_tests/src/main/python/cast_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

from asserts import assert_gpu_and_cpu_are_equal_collect, assert_gpu_and_cpu_are_equal_sql, assert_gpu_and_cpu_error, assert_gpu_fallback_collect, assert_py4j_exception
from data_gen import *
from spark_session import is_before_spark_311, is_before_spark_320, is_before_spark_330, with_gpu_session
from spark_session import is_before_spark_320, with_gpu_session, is_neg_dec_scale_bug_version
from marks import allow_non_gpu, approximate_float
from pyspark.sql.types import *
from spark_init_internal import spark_version

def test_cast_empty_string_to_int():
assert_gpu_and_cpu_are_equal_collect(
Expand Down Expand Up @@ -300,8 +301,12 @@ def test_cast_struct_with_unsupported_element_to_string_fallback(data_gen, legac
"spark.sql.legacy.castComplexTypesToString.enabled": legacy,
"spark.sql.legacy.allowNegativeScaleOfDecimal": 'true'}
)

@pytest.mark.skipif(not is_before_spark_311() and is_before_spark_330(), reason="RAPIDS doesn't support casting string to decimal for negative scale decimal in this version of Spark because of SPARK-37451")

# The bug SPARK-37451 only affects the following versions
def is_neg_dec_scale_bug_version():
return ("3.1.1" <= spark_version() < "3.1.3") or ("3.2.0" <= spark_version() < "3.2.1")

@pytest.mark.skipif(is_neg_dec_scale_bug_version(), reason="RAPIDS doesn't support casting string to decimal for negative scale decimal in this version of Spark because of SPARK-37451")
def test_cast_string_to_negative_scale_decimal():
assert_gpu_and_cpu_are_equal_collect(
lambda spark: unary_op_df(spark, StringGen("[0-9]{9}")).select(
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/src/main/python/spark_session.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021, NVIDIA CORPORATION.
# Copyright (c) 2020-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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ class Spark312dbShims extends Spark31XdbShims with Spark30Xuntil33XShims {
new ParquetFilters(schema, pushDownDate, pushDownTimestamp, pushDownDecimal, pushDownStartWith,
pushDownInFilterThreshold, caseSensitive, datetimeRebaseMode)
}
override def isCastingStringToNegDecimalScaleSupported: Boolean = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ class Spark313Shims extends Spark31XShims with Spark30Xuntil33XShims {

override def hasCastFloatTimestampUpcast: Boolean = true

override def isCastingStringToNegDecimalScaleSupported: Boolean = true
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-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.
Expand Down Expand Up @@ -37,4 +37,6 @@ class Spark320Shims extends Spark320until322Shims with Spark30Xuntil33XShims {
metadataColumns: Seq[AttributeReference]): RDD[InternalRow] = {
new FileScanRDD(sparkSession, readFunction, filePartitions)
}

override def isCastingStringToNegDecimalScaleSupported: Boolean = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,4 @@ class Spark322Shims extends Spark322PlusShims with Spark30Xuntil33XShims {
metadataColumns: Seq[AttributeReference]): RDD[InternalRow] = {
new FileScanRDD(sparkSession, readFunction, filePartitions)
}

override def isCastingStringToNegDecimalScaleSupported: Boolean = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,4 @@ import com.nvidia.spark.rapids.shims.v2._

class Spark330Shims extends Spark33XShims {
override def getSparkShimVersion: ShimVersion = SparkShimServiceProvider.VERSION

override def isCastingStringToNegDecimalScaleSupported: Boolean = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,6 @@ abstract class Spark30XShims extends Spark301until320Shims with Logging {
adaptivePlan.initialPlan
}

override def isCastingStringToNegDecimalScaleSupported: Boolean = true

// this is to help with an optimization in Spark 3.1, so we disable it by default in Spark 3.0.x
override def isEmptyRelation(relation: Any): Boolean = false
override def tryTransformIfEmptyRelation(mode: BroadcastMode): Option[Any] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,4 @@ trait Spark31XdbShimsBase extends SparkShims {
}

override def shouldFallbackOnAnsiTimestamp(): Boolean = false

override def isCastingStringToNegDecimalScaleSupported: Boolean = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -1035,8 +1035,6 @@ trait Spark320PlusShims extends SparkShims with RebaseShims with Logging {
adaptivePlan.initialPlan
}

override def isCastingStringToNegDecimalScaleSupported: Boolean = false

override def columnarAdaptivePlan(a: AdaptiveSparkPlanExec,
goal: CoalesceSizeGoal): SparkPlan = {
a.copy(supportsColumnar = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ trait SparkShims {
def int96ParquetRebaseWrite(conf: SQLConf): String
def int96ParquetRebaseReadKey: String
def int96ParquetRebaseWriteKey: String
def isCastingStringToNegDecimalScaleSupported: Boolean
def isCastingStringToNegDecimalScaleSupported: Boolean = true

def getParquetFilters(
schema: MessageType,
Expand Down