Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Firestarman <firestarmanllc@gmail.com>
  • Loading branch information
firestarman committed Jun 8, 2022
1 parent a3861f1 commit bfc2fd3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions integration_tests/src/main/python/arithmetic_ops_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import pytest

from asserts import assert_gpu_and_cpu_are_equal_collect, assert_gpu_and_cpu_error, assert_gpu_fallback_collect, assert_gpu_and_cpu_are_equal_sql
from conftest import is_databricks_runtime
from data_gen import *
from marks import ignore_order, incompat, approximate_float, allow_non_gpu
from pyspark.sql.types import *
Expand Down Expand Up @@ -302,18 +301,17 @@ def test_mod_pmod_by_zero(data_gen, overflow_exp):
def test_cast_neg_to_decimal_err():
# -12 cannot be represented as decimal(7,7)
data_gen = _decimal_gen_7_7
exception_str = "java.lang.ArithmeticException: " if is_before_spark_330() \
and not is_databricks104_or_later() else "org.apache.spark.SparkArithmeticException: "
dec_value = "Decimal(compact,-120000000,20,0})" if is_before_spark_330() \
or is_databricks_runtime() else "Decimal(compact, -120000000, 20, 0)"
exception_content = dec_value + " cannot be represented as Decimal(7, 7)"
exception_str = "java.lang.ArithmeticException: " + exception_content if is_before_spark_330() \
and not is_databricks104_or_later() else "org.apache.spark.SparkArithmeticException: " \
+ exception_content
else "Decimal(compact, -120000000, 20, 0)"
err_str = exception_str + dec_value + " cannot be represented as Decimal(7, 7)"

assert_gpu_and_cpu_error(
lambda spark : unary_op_df(spark, data_gen).selectExpr(
'cast(-12 as {})'.format(to_cast_string(data_gen.data_type))).collect(),
ansi_enabled_conf,
exception_str)
err_str)

@pytest.mark.parametrize('data_gen', _arith_data_gens_no_neg_scale, ids=idfn)
def test_mod_pmod_by_zero_not_ansi(data_gen):
Expand Down

0 comments on commit bfc2fd3

Please sign in to comment.