diff --git a/python/cudf_polars/cudf_polars/dsl/ir.py b/python/cudf_polars/cudf_polars/dsl/ir.py index 7f0920e1b57..83957e4286d 100644 --- a/python/cudf_polars/cudf_polars/dsl/ir.py +++ b/python/cudf_polars/cudf_polars/dsl/ir.py @@ -17,7 +17,7 @@ import itertools import types from functools import cache -from typing import TYPE_CHECKING, Any, Callable, ClassVar, NoReturn +from typing import TYPE_CHECKING, Any, Callable, ClassVar import pyarrow as pa from typing_extensions import assert_never @@ -56,7 +56,6 @@ "MapFunction", "Union", "HConcat", - "ExtContext", ] @@ -153,7 +152,9 @@ def evaluate(self, *, cache: MutableMapping[int, DataFrame]) -> DataFrame: since the translation phase should pick up things that we cannot handle. """ - raise NotImplementedError + raise NotImplementedError( + f"Evaluation of plan {type(self).__name__}" + ) # pragma: no cover @dataclasses.dataclass(slots=True) @@ -346,7 +347,9 @@ class Reduce(IR): expr: list[expr.NamedExpr] """List of expressions to evaluate to form the new dataframe.""" - def evaluate(self, *, cache: MutableMapping[int, DataFrame]) -> DataFrame: + def evaluate( + self, *, cache: MutableMapping[int, DataFrame] + ) -> DataFrame: # pragma: no cover; polars doesn't emit this node yet """Evaluate and return a dataframe.""" df = self.df.evaluate(cache=cache) columns = broadcast(*(e.evaluate(df) for e in self.expr)) @@ -938,23 +941,3 @@ def evaluate(self, *, cache: MutableMapping[int, DataFrame]) -> DataFrame: return DataFrame( list(itertools.chain.from_iterable(df.columns for df in dfs)), ) - - -@dataclasses.dataclass(slots=True) -class ExtContext(IR): - """ - Concatenate dataframes horizontally. - - Prefer HConcat, since this is going to be deprecated on the polars side. - """ - - df: IR - """Input.""" - extra: list[IR] - """List of extra inputs.""" - - def __post_init__(self) -> NoReturn: - """Validate preconditions.""" - raise NotImplementedError( - "ExtContext will be deprecated, use horizontal concat instead." - ) diff --git a/python/cudf_polars/cudf_polars/dsl/translate.py b/python/cudf_polars/cudf_polars/dsl/translate.py index adde3b1a9dc..41bc3032bc5 100644 --- a/python/cudf_polars/cudf_polars/dsl/translate.py +++ b/python/cudf_polars/cudf_polars/dsl/translate.py @@ -63,7 +63,9 @@ def __exit__(self, *args: Any) -> None: def _translate_ir( node: Any, visitor: NodeTraverser, schema: dict[str, plc.DataType] ) -> ir.IR: - raise NotImplementedError(f"Translation for {type(node).__name__}") + raise NotImplementedError( + f"Translation for {type(node).__name__}" + ) # pragma: no cover @_translate_ir.register @@ -172,7 +174,7 @@ def _( @_translate_ir.register def _( node: pl_ir.Reduce, visitor: NodeTraverser, schema: dict[str, plc.DataType] -) -> ir.IR: +) -> ir.IR: # pragma: no cover; polars doesn't emit this node yet with set_node(visitor, node.input): inp = translate_ir(visitor, n=None) exprs = [translate_named_expr(visitor, n=e) for e in node.expr] @@ -256,17 +258,6 @@ def _( return ir.HConcat(schema, [translate_ir(visitor, n=n) for n in node.inputs]) -@_translate_ir.register -def _( - node: pl_ir.ExtContext, visitor: NodeTraverser, schema: dict[str, plc.DataType] -) -> ir.IR: - return ir.ExtContext( - schema, - translate_ir(visitor, n=node.input), - [translate_ir(visitor, n=n) for n in node.contexts], - ) - - def translate_ir(visitor: NodeTraverser, *, n: int | None = None) -> ir.IR: """ Translate a polars-internal IR node to our representation. @@ -333,7 +324,9 @@ def translate_named_expr( def _translate_expr( node: Any, visitor: NodeTraverser, dtype: plc.DataType ) -> expr.Expr: - raise NotImplementedError(f"Translation for {type(node).__name__}") + raise NotImplementedError( + f"Translation for {type(node).__name__}" + ) # pragma: no cover @_translate_expr.register diff --git a/python/cudf_polars/tests/test_extcontext.py b/python/cudf_polars/tests/test_extcontext.py deleted file mode 100644 index 9daf88b4338..00000000000 --- a/python/cudf_polars/tests/test_extcontext.py +++ /dev/null @@ -1,23 +0,0 @@ -# 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.testing.asserts import assert_gpu_result_equal - - -def test_extcontext(): - ldf = pl.DataFrame( - { - "a": [1, 2, 3, 4, 5, 6, 7], - "b": [1, 1, 1, 1, 1, 1, 1], - } - ).lazy() - ldf2 = ldf.select((pl.col("b") + pl.col("a")).alias("c")) - query = ldf.with_context(ldf2).select(pl.col("b"), pl.col("c")) - with pytest.raises(pl.exceptions.ComputeError): - # ExtContext to be deprecated so we're not implementing it. - assert_gpu_result_equal(query)