-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Cleanup the legacy engines code path #22488
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
Changes from all commits
b92a9e9
4c95b90
e5b1aba
0a10efd
79bd93c
e43dff3
129d910
076c7db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,7 +10,6 @@ | |||||||||||||||||||
|
|
||||||||||||||||||||
| from cudf_polars import execute_with_cudf | ||||||||||||||||||||
| from cudf_polars.testing.asserts import ( | ||||||||||||||||||||
| assert_collect_raises, | ||||||||||||||||||||
| assert_gpu_result_equal, | ||||||||||||||||||||
| assert_ir_translation_raises, | ||||||||||||||||||||
| ) | ||||||||||||||||||||
|
|
@@ -303,12 +302,10 @@ def test_to_datetime( | |||||||||||||||||||
| if outcome == "translation_error": | ||||||||||||||||||||
| assert_ir_translation_raises(q, NotImplementedError) | ||||||||||||||||||||
| elif outcome == "collect_error": | ||||||||||||||||||||
| cudf_exc = pl.exceptions.InvalidOperationError | ||||||||||||||||||||
| assert_collect_raises( | ||||||||||||||||||||
| q, | ||||||||||||||||||||
| polars_except=pl.exceptions.InvalidOperationError, | ||||||||||||||||||||
| cudf_except=cudf_exc, | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| with pytest.raises(pl.exceptions.InvalidOperationError): | ||||||||||||||||||||
| q.collect() | ||||||||||||||||||||
| with pytest.raises(pl.exceptions.InvalidOperationError): | ||||||||||||||||||||
| q.collect(engine=pl.GPUEngine(executor="in-memory", raise_on_fail=True)) | ||||||||||||||||||||
| else: | ||||||||||||||||||||
| assert_gpu_result_equal(q, engine=engine) | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -453,11 +450,10 @@ def test_invalid_regex_raises(): | |||||||||||||||||||
|
|
||||||||||||||||||||
| q = df.select(pl.col("a").str.contains(r"ab)", strict=True)) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| assert_collect_raises( | ||||||||||||||||||||
| q, | ||||||||||||||||||||
| polars_except=pl.exceptions.ComputeError, | ||||||||||||||||||||
| cudf_except=pl.exceptions.ComputeError, | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| with pytest.raises(pl.exceptions.ComputeError): | ||||||||||||||||||||
| q.collect() | ||||||||||||||||||||
| with pytest.raises(pl.exceptions.ComputeError): | ||||||||||||||||||||
| q.collect(engine=pl.GPUEngine(executor="in-memory", raise_on_fail=True)) | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| @pytest.mark.parametrize("pattern", ["a{1000}", "a(?i:B)", ""]) | ||||||||||||||||||||
|
|
@@ -508,11 +504,10 @@ def test_string_from_float(engine: pl.GPUEngine, request, str_from_float_data): | |||||||||||||||||||
| def test_string_to_numeric_invalid(numeric_type): | ||||||||||||||||||||
| df = pl.LazyFrame({"a": ["a", "b", "c"]}) | ||||||||||||||||||||
| q = df.select(pl.col("a").cast(numeric_type)) | ||||||||||||||||||||
| assert_collect_raises( | ||||||||||||||||||||
| q, | ||||||||||||||||||||
| polars_except=pl.exceptions.InvalidOperationError, | ||||||||||||||||||||
| cudf_except=pl.exceptions.InvalidOperationError, | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| with pytest.raises(pl.exceptions.InvalidOperationError): | ||||||||||||||||||||
| q.collect() | ||||||||||||||||||||
| with pytest.raises(pl.exceptions.InvalidOperationError): | ||||||||||||||||||||
| q.collect(engine=pl.GPUEngine(executor="in-memory", raise_on_fail=True)) | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| @pytest.mark.parametrize("ignore_nulls", [False, True]) | ||||||||||||||||||||
|
|
@@ -548,11 +543,10 @@ def test_string_zfill(engine: pl.GPUEngine, fill, input_strings): | |||||||||||||||||||
| q = ldf.select(pl.col("a").str.zfill(fill)) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if fill is not None and fill < 0: | ||||||||||||||||||||
| assert_collect_raises( | ||||||||||||||||||||
| q, | ||||||||||||||||||||
| polars_except=pl.exceptions.InvalidOperationError, | ||||||||||||||||||||
| cudf_except=pl.exceptions.InvalidOperationError, | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| with pytest.raises(pl.exceptions.InvalidOperationError): | ||||||||||||||||||||
| q.collect() | ||||||||||||||||||||
| with pytest.raises(pl.exceptions.InvalidOperationError): | ||||||||||||||||||||
| q.collect(engine=pl.GPUEngine(executor="in-memory", raise_on_fail=True)) | ||||||||||||||||||||
| else: | ||||||||||||||||||||
| assert_gpu_result_equal(q, engine=engine) | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -588,23 +582,19 @@ def test_string_zfill_column(engine: pl.GPUEngine, fill): | |||||||||||||||||||
| ).lazy() | ||||||||||||||||||||
| q = ldf.select(pl.col("input_strings").str.zfill(pl.col("fill"))) | ||||||||||||||||||||
| if fill is not None and fill < 0: | ||||||||||||||||||||
| assert_collect_raises( | ||||||||||||||||||||
| q, | ||||||||||||||||||||
| polars_except=pl.exceptions.InvalidOperationError, | ||||||||||||||||||||
| cudf_except=(), | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| with pytest.raises(pl.exceptions.InvalidOperationError): | ||||||||||||||||||||
| q.collect() | ||||||||||||||||||||
| q.collect(engine=pl.GPUEngine(executor="in-memory", raise_on_fail=True)) | ||||||||||||||||||||
| else: | ||||||||||||||||||||
|
Comment on lines
+585
to
588
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrap the GPU collect call in The GPU call is currently unguarded in this branch, so it can fail the test unexpectedly instead of asserting the intended exception behavior. Proposed fix if fill is not None and fill < 0:
with pytest.raises(pl.exceptions.InvalidOperationError):
q.collect()
- q.collect(engine=pl.GPUEngine(executor="in-memory", raise_on_fail=True))
+ with pytest.raises(pl.exceptions.InvalidOperationError):
+ q.collect(engine=pl.GPUEngine(executor="in-memory", raise_on_fail=True))📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| assert_gpu_result_equal(q, engine=engine) | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| def test_string_zfill_forbidden_chars(): | ||||||||||||||||||||
| ldf = pl.LazyFrame({"a": ["Café", "345", "東京", None]}) | ||||||||||||||||||||
| q = ldf.select(pl.col("a").str.zfill(3)) | ||||||||||||||||||||
| assert_collect_raises( | ||||||||||||||||||||
| q, | ||||||||||||||||||||
| polars_except=(), | ||||||||||||||||||||
| cudf_except=pl.exceptions.InvalidOperationError, | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| q.collect() | ||||||||||||||||||||
| with pytest.raises(pl.exceptions.InvalidOperationError): | ||||||||||||||||||||
| q.collect(engine=pl.GPUEngine(executor="in-memory", raise_on_fail=True)) | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| @pytest.mark.parametrize( | ||||||||||||||||||||
|
|
||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inlining it instead of calling
assert_collect_raisesis simpler IMO.