Skip to content

Commit

Permalink
Replace GPU-unsupported \z with an alternative RLIKE expression (#1…
Browse files Browse the repository at this point in the history
…0090)

Signed-off-by: Gera Shegalov <[email protected]>
  • Loading branch information
gerashegalov authored Dec 26, 2023
1 parent 0a339de commit e09c144
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions integration_tests/src/main/python/conditionals_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_coalesce(data_gen):
s1 = with_cpu_session(
lambda spark: gen_scalar(data_gen, force_no_nulls=not isinstance(data_gen, NullGen)))
# we want lots of nulls
gen = StructGen([('_c' + str(x), data_gen.copy_special_case(None, weight=1000.0))
gen = StructGen([('_c' + str(x), data_gen.copy_special_case(None, weight=1000.0))
for x in range(0, num_cols)], nullable=False)
command_args = [f.col('_c' + str(x)) for x in range(0, num_cols)]
command_args.append(s1)
Expand Down Expand Up @@ -214,7 +214,7 @@ def test_conditional_with_side_effects_cast(data_gen):
ansi_enabled_conf, {'spark.rapids.sql.regexp.enabled': True})
assert_gpu_and_cpu_are_equal_collect(
lambda spark : unary_op_df(spark, data_gen).selectExpr(
'IF(a RLIKE "^[0-9]{1,5}\\z", CAST(a AS INT), 0)'),
'IF(a RLIKE "^[0-9]{5,}", CAST(SUBSTR(a, 0, 5) AS INT), 0)'),
conf = test_conf)

@pytest.mark.parametrize('data_gen', [mk_str_gen('[0-9]{1,9}')], ids=idfn)
Expand All @@ -225,8 +225,8 @@ def test_conditional_with_side_effects_case_when(data_gen):
assert_gpu_and_cpu_are_equal_collect(
lambda spark : unary_op_df(spark, data_gen).selectExpr(
'CASE \
WHEN a RLIKE "^[0-9]{1,3}\\z" THEN CAST(a AS INT) \
WHEN a RLIKE "^[0-9]{4,6}\\z" THEN CAST(a AS INT) + 123 \
WHEN a RLIKE "^[0-9]{6}" THEN CAST(SUBSTR(a, 0, 6) AS INT) + 123 \
WHEN a RLIKE "^[0-9]{3}" THEN CAST(SUBSTR(a, 0, 3) AS INT) \
ELSE -1 END'),
conf = test_conf)

Expand Down

0 comments on commit e09c144

Please sign in to comment.