diff --git a/python/cudf_polars/cudf_polars/dsl/ir.py b/python/cudf_polars/cudf_polars/dsl/ir.py index 46241ab8e71..9fb2468e4e9 100644 --- a/python/cudf_polars/cudf_polars/dsl/ir.py +++ b/python/cudf_polars/cudf_polars/dsl/ir.py @@ -165,6 +165,10 @@ class PythonScan(IR): predicate: expr.NamedExpr | None """Filter to apply to the constructed dataframe before returning it.""" + def __post_init__(self): + """Validate preconditions.""" + raise NotImplementedError("PythonScan not implemented") + @dataclasses.dataclass(slots=True) class Scan(IR): diff --git a/python/cudf_polars/tests/test_python_scan.py b/python/cudf_polars/tests/test_python_scan.py new file mode 100644 index 00000000000..c03474e3dc8 --- /dev/null +++ b/python/cudf_polars/tests/test_python_scan.py @@ -0,0 +1,20 @@ +# 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 import translate_ir + + +def test_python_scan(): + def source(with_columns, predicate, nrows): + return pl.DataFrame({"a": pl.Series([1, 2, 3], dtype=pl.Int8())}) + + q = pl.LazyFrame._scan_python_function({"a": pl.Int8}, source, pyarrow=False) + with pytest.raises(NotImplementedError): + _ = translate_ir(q._ldf.visit()) + + assert q.collect().equals(source(None, None, None))