From 0f61e37440e9a5625bee9ad1d1259a2f5a030170 Mon Sep 17 00:00:00 2001 From: Matthew Murray <41342305+Matt711@users.noreply.github.com> Date: Thu, 30 Jan 2025 10:48:16 -0500 Subject: [PATCH] Remove predicate param from `DataFrameScan` IR (#17852) Follow up to #17771. THis PR removed the `predicate` param from `DataFrameScan` which is no longer used. Authors: - Matthew Murray (https://github.com/Matt711) Approvers: - Matthew Roeschke (https://github.com/mroeschke) URL: https://github.com/rapidsai/cudf/pull/17852 --- .../cudf_polars/dsl/expressions/datetime.py | 2 +- python/cudf_polars/cudf_polars/dsl/ir.py | 12 +++--------- python/cudf_polars/cudf_polars/dsl/translate.py | 3 --- python/cudf_polars/cudf_polars/experimental/io.py | 3 +-- python/cudf_polars/tests/dsl/test_traversal.py | 4 +--- 5 files changed, 6 insertions(+), 18 deletions(-) diff --git a/python/cudf_polars/cudf_polars/dsl/expressions/datetime.py b/python/cudf_polars/cudf_polars/dsl/expressions/datetime.py index a145cd770f9..64011844a35 100644 --- a/python/cudf_polars/cudf_polars/dsl/expressions/datetime.py +++ b/python/cudf_polars/cudf_polars/dsl/expressions/datetime.py @@ -57,8 +57,8 @@ class Name(IntEnum): OffsetBy = auto() OrdinalDay = auto() Quarter = auto() - ReplaceTimeZone = auto() Replace = auto() + ReplaceTimeZone = auto() Round = auto() Second = auto() Time = auto() diff --git a/python/cudf_polars/cudf_polars/dsl/ir.py b/python/cudf_polars/cudf_polars/dsl/ir.py index 74f026e57cd..8ec14fb2b7f 100644 --- a/python/cudf_polars/cudf_polars/dsl/ir.py +++ b/python/cudf_polars/cudf_polars/dsl/ir.py @@ -696,14 +696,12 @@ class DataFrameScan(IR): This typically arises from ``q.collect().lazy()`` """ - __slots__ = ("config_options", "df", "predicate", "projection") - _non_child = ("schema", "df", "projection", "predicate", "config_options") + __slots__ = ("config_options", "df", "projection") + _non_child = ("schema", "df", "projection", "config_options") df: Any """Polars LazyFrame object.""" projection: tuple[str, ...] | None """List of columns to project out.""" - predicate: expr.NamedExpr | None - """Mask to apply.""" config_options: dict[str, Any] """GPU-specific configuration options""" @@ -712,15 +710,13 @@ def __init__( schema: Schema, df: Any, projection: Sequence[str] | None, - predicate: expr.NamedExpr | None, config_options: dict[str, Any], ): self.schema = schema self.df = df self.projection = tuple(projection) if projection is not None else None - self.predicate = predicate self.config_options = config_options - self._non_child_args = (schema, df, self.projection, predicate) + self._non_child_args = (schema, df, self.projection) self.children = () def get_hashable(self) -> Hashable: @@ -736,7 +732,6 @@ def get_hashable(self) -> Hashable: schema_hash, id(self.df), self.projection, - self.predicate, json.dumps(self.config_options), ) @@ -746,7 +741,6 @@ def do_evaluate( schema: Schema, df: Any, projection: tuple[str, ...] | None, - predicate: expr.NamedExpr | None, ) -> DataFrame: """Evaluate and return a dataframe.""" pdf = pl.DataFrame._from_pydf(df) diff --git a/python/cudf_polars/cudf_polars/dsl/translate.py b/python/cudf_polars/cudf_polars/dsl/translate.py index 640fc8d81c5..966c7fd7be7 100644 --- a/python/cudf_polars/cudf_polars/dsl/translate.py +++ b/python/cudf_polars/cudf_polars/dsl/translate.py @@ -260,9 +260,6 @@ def _( schema, node.df, node.projection, - translate_named_expr(translator, n=node.selection) - if node.selection is not None - else None, translator.config.config.copy(), ) diff --git a/python/cudf_polars/cudf_polars/experimental/io.py b/python/cudf_polars/cudf_polars/experimental/io.py index 2a5b400af4c..d24ae5772c0 100644 --- a/python/cudf_polars/cudf_polars/experimental/io.py +++ b/python/cudf_polars/cudf_polars/experimental/io.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +# SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. # SPDX-License-Identifier: Apache-2.0 """Multi-partition IO Logic.""" @@ -42,7 +42,6 @@ def _( ir.schema, ir.df.slice(offset, length), ir.projection, - ir.predicate, ir.config_options, ) for offset in range(0, nrows, length) diff --git a/python/cudf_polars/tests/dsl/test_traversal.py b/python/cudf_polars/tests/dsl/test_traversal.py index 9fcca2e290e..4a9c2f90c24 100644 --- a/python/cudf_polars/tests/dsl/test_traversal.py +++ b/python/cudf_polars/tests/dsl/test_traversal.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +# SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations @@ -119,7 +119,6 @@ def replace_df(node, rec): node.schema, new_df._df, node.projection, - node.predicate, node.config_options, ) return reuse_if_unchanged(node, rec) @@ -151,7 +150,6 @@ def replace_scan(node, rec): node.schema, right._df, node.with_columns, - node.predicate, node.config_options, ) return reuse_if_unchanged(node, rec)