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

Update the error string for test_cast_neg_to_decimal_err on 330[databricks] #5784

Merged
merged 2 commits into from
Jun 8, 2022
Merged
Changes from all 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: 6 additions & 5 deletions integration_tests/src/main/python/arithmetic_ops_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,16 +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_content = "Decimal(compact,-120000000,20,0}) 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
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() \
firestarman marked this conversation as resolved.
Show resolved Hide resolved
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