-
Notifications
You must be signed in to change notification settings - Fork 889
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn on cuDF failure when
POLARS_VERBOSE
is true (#16308)
Just something quick to get us started here Closes #16256 Authors: - https://github.com/brandon-b-miller - Lawrence Mitchell (https://github.com/wence-) Approvers: - Lawrence Mitchell (https://github.com/wence-) URL: #16308
- Loading branch information
1 parent
62625f1
commit 743264f
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from __future__ import annotations | ||
|
||
import pytest | ||
|
||
import polars as pl | ||
|
||
from cudf_polars.dsl.ir import IR | ||
from cudf_polars.testing.asserts import ( | ||
assert_gpu_result_equal, | ||
assert_ir_translation_raises, | ||
) | ||
|
||
|
||
def test_polars_verbose_warns(monkeypatch): | ||
def raise_unimplemented(self): | ||
raise NotImplementedError("We don't support this") | ||
|
||
monkeypatch.setattr(IR, "__post_init__", raise_unimplemented) | ||
q = pl.LazyFrame({}) | ||
# Ensure that things raise | ||
assert_ir_translation_raises(q, NotImplementedError) | ||
with ( | ||
pl.Config(verbose=True), | ||
pytest.raises(pl.exceptions.ComputeError), | ||
pytest.warns( | ||
pl.exceptions.PerformanceWarning, | ||
match="Query execution with GPU not supported", | ||
), | ||
): | ||
# And ensure that collecting issues the correct warning. | ||
assert_gpu_result_equal(q) |