Skip to content

Commit

Permalink
Update the error message for div_by_zero test (#5718)
Browse files Browse the repository at this point in the history
Signed-off-by: Firestarman <[email protected]>
  • Loading branch information
firestarman authored Jun 2, 2022
1 parent db7b611 commit 230ac0a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions integration_tests/src/main/python/arithmetic_ops_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,13 +798,17 @@ def _test_div_by_zero(ansi_mode, expr):
ansi_conf = {'spark.sql.ansi.enabled': ansi_mode == 'ansi'}
data_gen = lambda spark: two_col_df(spark, IntegerGen(), IntegerGen(min_val=0, max_val=0), length=1)
div_by_zero_func = lambda spark: data_gen(spark).selectExpr(expr)
if is_before_spark_320():
err_message = 'java.lang.ArithmeticException: divide by zero'
elif is_before_spark_330():
err_message = 'SparkArithmeticException: divide by zero'
else:
err_message = 'SparkArithmeticException: Division by zero'

if ansi_mode == 'ansi':
assert_gpu_and_cpu_error(df_fun=lambda spark: div_by_zero_func(spark).collect(),
conf=ansi_conf,
error_message=
'java.lang.ArithmeticException: divide by zero' if is_before_spark_320() else
'SparkArithmeticException: divide by zero')
error_message=err_message)
else:
assert_gpu_and_cpu_are_equal_collect(div_by_zero_func, ansi_conf)

Expand Down

0 comments on commit 230ac0a

Please sign in to comment.