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

Fix issues when no value can be extracted from a regular expression #10552

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions integration_tests/src/main/python/regexp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,10 +813,11 @@ def test_regexp_extract_all_idx_zero():
),
conf=_regexp_conf)

def test_regexp_extract_all_idx_positive():
@pytest.mark.parametrize('slices', [4, 40, 400], ids=idfn)
def test_regexp_extract_all_idx_positive(slices):
gen = mk_str_gen('[abcd]{0,3}[0-9]{0,3}-[0-9]{0,3}[abcd]{1,3}')
assert_gpu_and_cpu_are_equal_collect(
lambda spark: unary_op_df(spark, gen).selectExpr(
lambda spark: unary_op_df(spark, gen, num_slices=slices).selectExpr(
'regexp_extract_all(a, "([a-d]+).*([0-9])", 1)',
'regexp_extract_all(a, "(a)(b)", 2)',
'regexp_extract_all(a, "([a-z0-9]((([abcd](\\\\d?)))))", 3)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ case class GpuRegExpExtractAll(
}
}
withResource(stringCols) { _ =>
ColumnVector.makeList(stringCols: _*)
ColumnVector.makeList(rowCount, DType.STRING, stringCols: _*)
}
}
}
Expand Down
Loading