diff --git a/python/cudf/cudf/core/_internals/copying.py b/python/cudf/cudf/core/_internals/copying.py index d7549bd5d9f1..2b0d5f6d37c1 100644 --- a/python/cudf/cudf/core/_internals/copying.py +++ b/python/cudf/cudf/core/_internals/copying.py @@ -19,7 +19,7 @@ def gather( columns: Sequence[ColumnBase], gather_map: NumericalColumn, nullify: bool = False, -) -> list[plc.Column]: +) -> tuple[plc.Column, ...]: with access_columns( *columns, gather_map, mode="read", scope="internal" ) as (*columns, gather_map): @@ -38,7 +38,7 @@ def scatter( scatter_map: NumericalColumn, target_columns: list[ColumnBase], bounds_check: bool = True, -): +) -> tuple[plc.Column, ...]: """ Scattering source into target as per the scatter map. `source` can be a list of scalars, or a list of columns. The number of @@ -51,7 +51,7 @@ def scatter( raise ValueError("Mismatched number of source and target columns.") if len(sources) == 0: - return [] + return () if bounds_check: n_rows = len(target_columns[0]) @@ -80,7 +80,7 @@ def scatter( def columns_split( input_columns: Sequence[ColumnBase], splits: list[int] -) -> list[list[plc.Column]]: +) -> list[tuple[plc.Column, ...]]: with access_columns( *input_columns, mode="read", scope="internal" ) as input_columns: diff --git a/python/cudf/cudf/core/_internals/sorting.py b/python/cudf/cudf/core/_internals/sorting.py index bb43a35df8b0..5f804ec3c9d0 100644 --- a/python/cudf/cudf/core/_internals/sorting.py +++ b/python/cudf/cudf/core/_internals/sorting.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations @@ -143,7 +143,7 @@ def sort_by_key( na_position: Iterable[Literal["first", "last"]], *, stable: bool, -) -> list[plc.Column]: +) -> tuple[plc.Column, ...]: """ Sort a table by given keys @@ -165,8 +165,8 @@ def sort_by_key( Returns ------- - list[Column] - list of value columns sorted by keys + tuple[Column, ...] + value columns sorted by keys """ column_order, null_precedence = ordering(ascending, na_position) func = ( diff --git a/python/cudf/cudf/core/frame.py b/python/cudf/cudf/core/frame.py index 8f04ff94ecdc..ad3e3c131c1d 100644 --- a/python/cudf/cudf/core/frame.py +++ b/python/cudf/cudf/core/frame.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations @@ -249,7 +249,7 @@ def _drop_duplicates_columns( keys: list[int], keep: Literal["first", "last", False], nulls_are_equal: bool, - ) -> list[plc.Column]: + ) -> tuple[plc.Column, ...]: """Core stable_distinct implementation shared by Index and IndexedFrame.""" _keep_options = { "first": plc.stream_compaction.DuplicateKeepOption.KEEP_FIRST, @@ -277,7 +277,7 @@ def _drop_nulls_columns( keys: list[int], how: Literal["any", "all"], thresh: int | None = None, - ) -> list[plc.Column]: + ) -> tuple[plc.Column, ...]: """Core drop_nulls implementation shared by Index and IndexedFrame.""" if how not in {"any", "all"}: raise ValueError("how must be 'any' or 'all'") diff --git a/python/cudf/cudf/core/indexed_frame.py b/python/cudf/cudf/core/indexed_frame.py index a6e4708bbd31..c4ab629b29e6 100644 --- a/python/cudf/cudf/core/indexed_frame.py +++ b/python/cudf/cudf/core/indexed_frame.py @@ -3455,7 +3455,7 @@ def _split(self, splits: list[int], keep_index: bool = True) -> list[Self]: ) def split_with_dtypes( - split: list[plc.Column], + split: tuple[plc.Column, ...], ) -> list[ColumnBase]: return [ ColumnBase.create(col, dtype) diff --git a/python/cudf/cudf/io/parquet.py b/python/cudf/cudf/io/parquet.py index bd2b7725bf21..143e2e0fa12e 100644 --- a/python/cudf/cudf/io/parquet.py +++ b/python/cudf/cudf/io/parquet.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations @@ -1419,13 +1419,13 @@ def _read_parquet( column_names = tbl_w_meta.column_names(include_children=False) child_names = tbl_w_meta.child_names per_file_user_data = tbl_w_meta.per_file_user_data - concatenated_columns = tbl_w_meta.tbl.columns() + concatenated_columns = tbl_w_meta.tbl.release() # save memory del tbl_w_meta while reader.has_next(): - columns = reader.read_chunk().tbl.columns() + columns = reader.read_chunk().tbl.release() # Iterate in reverse to avoid O(n²) cost from popping for i in range(len(concatenated_columns) - 1, -1, -1): concatenated_columns[i] = plc.concatenate.concatenate( diff --git a/python/cudf_polars/cudf_polars/dsl/expressions/rolling.py b/python/cudf_polars/cudf_polars/dsl/expressions/rolling.py index 70ced1c440d8..7f9c2868c04b 100644 --- a/python/cudf_polars/cudf_polars/dsl/expressions/rolling.py +++ b/python/cudf_polars/cudf_polars/dsl/expressions/rolling.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. +# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # TODO: remove need for this # ruff: noqa: D101 @@ -422,6 +422,7 @@ def _( # type: ignore[no-untyped-def] # Instead of calling self._gather_columns, let's call plc.copying.gather directly # since we need plc.Column objects, not cudf_polars Column objects + val_cols: Sequence[plc.Column] if order_index is not None: plc_cols = [ ne.value.children[0].evaluate(df, context=ExecutionContext.FRAME).obj @@ -694,15 +695,16 @@ def _build_groupby_requests( eval_cols.append(child.evaluate(df, context=ExecutionContext.FRAME).obj) val_nodes.append((ne, val)) + gathered_cols: Sequence[plc.Column] = eval_cols if order_index is not None and eval_cols: - eval_cols = plc.copying.gather( + gathered_cols = plc.copying.gather( plc.Table(eval_cols), order_index, plc.copying.OutOfBoundsPolicy.NULLIFY, stream=df.stream, ).columns() - gathered_iter = iter(eval_cols) + gathered_iter = iter(gathered_cols) for ne in named_exprs: val = ne.value if isinstance(val, expr.Len): diff --git a/python/cudf_polars/cudf_polars/dsl/expressions/string.py b/python/cudf_polars/cudf_polars/dsl/expressions/string.py index e8808099ab3f..7b4faf0ab6b4 100644 --- a/python/cudf_polars/cudf_polars/dsl/expressions/string.py +++ b/python/cudf_polars/cudf_polars/dsl/expressions/string.py @@ -671,7 +671,7 @@ def do_evaluate( max_splits - 1, stream=df.stream, ) - children = plc_table.columns() + children = plc_table.release() ref_column = children[0] if (remainder := n + int(not is_split_n) - len(children)) > 0: # Reach expected number of splits by padding with nulls diff --git a/python/cudf_polars/cudf_polars/dsl/ir.py b/python/cudf_polars/cudf_polars/dsl/ir.py index 2334b4069533..62a1a6089e05 100644 --- a/python/cudf_polars/cudf_polars/dsl/ir.py +++ b/python/cudf_polars/cudf_polars/dsl/ir.py @@ -822,9 +822,9 @@ def read_csv_header( chunk = reader.read_chunk() # TODO: Nested column names names = chunk.column_names(include_children=False) - concatenated_columns = chunk.tbl.columns() + concatenated_columns = chunk.tbl.release() while reader.has_next(): - columns = reader.read_chunk().tbl.columns() + columns = reader.read_chunk().tbl.release() # Discard columns while concatenating to reduce memory footprint. # Reverse order to avoid O(n^2) list popping cost. for i in reversed(range(len(concatenated_columns))): @@ -2328,7 +2328,7 @@ def _reorder_maps( *, left_primary: bool = True, stream: Stream, - ) -> list[plc.Column]: + ) -> tuple[plc.Column, ...]: """ Reorder gather maps to satisfy polars join order restrictions. @@ -2355,7 +2355,7 @@ def _reorder_maps( Returns ------- - list[plc.Column] + tuple[plc.Column, ...] Reordered left and right gather maps. Notes diff --git a/python/pylibcudf/pylibcudf/column.pyi b/python/pylibcudf/pylibcudf/column.pyi index a5fe555aec25..53513aec8ac1 100644 --- a/python/pylibcudf/pylibcudf/column.pyi +++ b/python/pylibcudf/pylibcudf/column.pyi @@ -50,7 +50,7 @@ class Column: mask: Span | None, null_count: int, offset: int, - children: list[Column], + children: Iterable[Column], validate: bool = True, ) -> None: ... def type(self) -> DataType: ... @@ -94,7 +94,10 @@ class Column: ) -> Column: ... @staticmethod def from_rmm_buffer( - buff: DeviceBuffer, dtype: DataType, size: int, children: list[Column] + buff: DeviceBuffer, + dtype: DataType, + size: int, + children: Iterable[Column], ) -> Column: ... def to_arrow( self, diff --git a/python/pylibcudf/pylibcudf/column.pyx b/python/pylibcudf/pylibcudf/column.pyx index 925a05273640..bb4cad68f54f 100644 --- a/python/pylibcudf/pylibcudf/column.pyx +++ b/python/pylibcudf/pylibcudf/column.pyx @@ -333,7 +333,7 @@ cdef class Column: The number of null rows in the column. offset : int The offset into the data buffer where the column's data begins. - children : list + children : Iterable[Column] The children of this column if it is a compound column type. validate : bool, default True Whether to validate that data and mask satisfy Span protocol. @@ -343,8 +343,9 @@ cdef class Column: def __init__( self, DataType data_type not None, size_type size, object data, object mask, size_type null_count, size_type offset, - list children, bint validate=True + children, bint validate=True ): + children = list(children) if not all(isinstance(c, Column) for c in children): raise ValueError("All children must be pylibcudf Column objects") @@ -600,7 +601,7 @@ cdef class Column: DeviceBuffer buff, DataType dtype, size_type size, - list children, + children, ): """ Create a Column from an RMM DeviceBuffer. @@ -613,14 +614,15 @@ cdef class Column: The number of rows in the column. dtype : DataType The type of the data in the buffer. - children : list - List of child columns. + children : Iterable[Column] + The child columns. Notes ----- To provide a mask and null count, use `Column.with_mask` after this method. """ + children = list(children) if plc_is_fixed_width(dtype) and len(children) != 0: raise ValueError("Fixed-width types must have zero children.") elif dtype.id() == type_id.STRING and len(children) != 1: diff --git a/python/pylibcudf/pylibcudf/concatenate.pxd b/python/pylibcudf/pylibcudf/concatenate.pxd index 60189ba4406c..946849aeb7cd 100644 --- a/python/pylibcudf/pylibcudf/concatenate.pxd +++ b/python/pylibcudf/pylibcudf/concatenate.pxd @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 from .table cimport Table @@ -10,4 +10,4 @@ from rmm.pylibrmm.memory_resource cimport DeviceMemoryResource # unify the column and table paths without using runtime dispatch instead. In this case # we choose to prioritize API consistency over performance, so we use the same function # with a bit of runtime dispatch overhead. -cpdef concatenate(list objects, object stream = *, DeviceMemoryResource mr=*) +cpdef concatenate(objects, object stream = *, DeviceMemoryResource mr=*) diff --git a/python/pylibcudf/pylibcudf/concatenate.pyi b/python/pylibcudf/pylibcudf/concatenate.pyi index 59379e01c46f..8a6b0cfbc39b 100644 --- a/python/pylibcudf/pylibcudf/concatenate.pyi +++ b/python/pylibcudf/pylibcudf/concatenate.pyi @@ -1,6 +1,8 @@ -# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +from collections.abc import Sequence + from rmm.pylibrmm.memory_resource import DeviceMemoryResource from pylibcudf.column import Column @@ -8,7 +10,7 @@ from pylibcudf.table import Table from pylibcudf.utils import CudaStreamLike def concatenate[ColumnOrTable: (Column, Table)]( - objects: list[ColumnOrTable], + objects: Sequence[ColumnOrTable], stream: CudaStreamLike | None = None, mr: DeviceMemoryResource | None = None, ) -> ColumnOrTable: ... diff --git a/python/pylibcudf/pylibcudf/concatenate.pyx b/python/pylibcudf/pylibcudf/concatenate.pyx index 9921d5b1a396..d9bf0af16655 100644 --- a/python/pylibcudf/pylibcudf/concatenate.pyx +++ b/python/pylibcudf/pylibcudf/concatenate.pyx @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 from libcpp.memory cimport unique_ptr @@ -20,13 +20,13 @@ from cuda.bindings.cyruntime cimport cudaStream_t __all__ = ["concatenate"] -cpdef concatenate(list objects, object stream=None, DeviceMemoryResource mr=None): +cpdef concatenate(objects, object stream=None, DeviceMemoryResource mr=None): """Concatenate columns or tables. Parameters ---------- - objects : Union[List[Column], List[Table]] - The list of Columns or Tables to concatenate. + objects : Sequence[Column] | Sequence[Table] + The Columns or Tables to concatenate. stream : Stream | None CUDA stream on which to perform the operation. mr : DeviceMemoryResource | None diff --git a/python/pylibcudf/pylibcudf/io/types.pyi b/python/pylibcudf/pylibcudf/io/types.pyi index e6b17f169f2d..bad1931a4582 100644 --- a/python/pylibcudf/pylibcudf/io/types.pyi +++ b/python/pylibcudf/pylibcudf/io/types.pyi @@ -87,7 +87,7 @@ class TableWithMetadata: self, tbl: Table, column_names: list[ColumnNameSpec] ) -> None: ... @property - def columns(self) -> list[Column]: ... + def columns(self) -> tuple[Column, ...]: ... @overload def column_names(self, include_children: Literal[False]) -> list[str]: ... @overload diff --git a/python/pylibcudf/pylibcudf/io/types.pyx b/python/pylibcudf/pylibcudf/io/types.pyx index af07f31d02e2..5a56c02706c1 100644 --- a/python/pylibcudf/pylibcudf/io/types.pyx +++ b/python/pylibcudf/pylibcudf/io/types.pyx @@ -349,7 +349,7 @@ cdef class TableWithMetadata: @property def columns(self): """ - Return a list containing the columns of the table + Return a tuple containing the columns of the table """ return self.tbl.columns() diff --git a/python/pylibcudf/pylibcudf/null_mask.pxd b/python/pylibcudf/pylibcudf/null_mask.pxd index e7fa70e23ae1..0521121dd4d9 100644 --- a/python/pylibcudf/pylibcudf/null_mask.pxd +++ b/python/pylibcudf/pylibcudf/null_mask.pxd @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 from pylibcudf.libcudf.types cimport mask_state, size_type @@ -30,9 +30,9 @@ cpdef DeviceBuffer create_null_mask( DeviceMemoryResource mr=* ) -cpdef tuple bitmask_and(list columns, object stream = *, DeviceMemoryResource mr=*) +cpdef tuple bitmask_and(columns, object stream = *, DeviceMemoryResource mr=*) -cpdef tuple bitmask_or(list columns, object stream = *, DeviceMemoryResource mr=*) +cpdef tuple bitmask_or(columns, object stream = *, DeviceMemoryResource mr=*) cpdef size_type null_count( object bitmask, diff --git a/python/pylibcudf/pylibcudf/null_mask.pyi b/python/pylibcudf/pylibcudf/null_mask.pyi index 45e130b704ef..396905eb5723 100644 --- a/python/pylibcudf/pylibcudf/null_mask.pyi +++ b/python/pylibcudf/pylibcudf/null_mask.pyi @@ -1,6 +1,8 @@ -# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +from collections.abc import Sequence + from rmm.pylibrmm.device_buffer import DeviceBuffer from rmm.pylibrmm.memory_resource import DeviceMemoryResource @@ -29,12 +31,12 @@ def create_null_mask( mr: DeviceMemoryResource | None = None, ) -> DeviceBuffer: ... def bitmask_and( - columns: list[Column], + columns: Sequence[Column], stream: CudaStreamLike | None = None, mr: DeviceMemoryResource | None = None, ) -> tuple[DeviceBuffer, int]: ... def bitmask_or( - columns: list[Column], + columns: Sequence[Column], stream: CudaStreamLike | None = None, mr: DeviceMemoryResource | None = None, ) -> tuple[DeviceBuffer, int]: ... diff --git a/python/pylibcudf/pylibcudf/null_mask.pyx b/python/pylibcudf/pylibcudf/null_mask.pyx index 5178f979d248..bdb92b66bb02 100644 --- a/python/pylibcudf/pylibcudf/null_mask.pyx +++ b/python/pylibcudf/pylibcudf/null_mask.pyx @@ -192,15 +192,15 @@ cpdef DeviceBuffer create_null_mask( return buffer_to_python(move(db), _stream, mr) -cpdef tuple bitmask_and(list columns, object stream=None, DeviceMemoryResource mr=None): +cpdef tuple bitmask_and(columns, object stream=None, DeviceMemoryResource mr=None): """Performs bitwise AND of the bitmasks of a list of columns. For details, see :cpp:func:`bitmask_and`. Parameters ---------- - columns : list - The list of columns + columns : Sequence[Column] + The columns stream : Stream | None CUDA stream on which to perform the operation. mr : DeviceMemoryResource | None @@ -226,15 +226,15 @@ cpdef tuple bitmask_and(list columns, object stream=None, DeviceMemoryResource m return buffer_to_python(move(c_result.first), _stream, mr), c_result.second -cpdef tuple bitmask_or(list columns, object stream=None, DeviceMemoryResource mr=None): +cpdef tuple bitmask_or(columns, object stream=None, DeviceMemoryResource mr=None): """Performs bitwise OR of the bitmasks of a list of columns. For details, see :cpp:func:`bitmask_or`. Parameters ---------- - columns : list - The list of columns + columns : Sequence[Column] + The columns stream : Stream | None CUDA stream on which to perform the operation. mr : DeviceMemoryResource | None diff --git a/python/pylibcudf/pylibcudf/table.pxd b/python/pylibcudf/pylibcudf/table.pxd index 5e9b9834f623..0cc711f5f567 100644 --- a/python/pylibcudf/pylibcudf/table.pxd +++ b/python/pylibcudf/pylibcudf/table.pxd @@ -7,8 +7,8 @@ from pylibcudf.libcudf.table.table_view cimport table_view from rmm.pylibrmm.memory_resource cimport DeviceMemoryResource cdef class Table: - # List[pylibcudf.Column] - cdef public list _columns + # Tuple[pylibcudf.Column] + cdef tuple _columns cdef table_view view(self) @@ -33,5 +33,6 @@ cdef class Table: object stream, ) - cpdef list columns(self) + cpdef tuple columns(self) + cpdef list release(self) cpdef Table copy(self, object stream = *, DeviceMemoryResource mr=*) diff --git a/python/pylibcudf/pylibcudf/table.pyi b/python/pylibcudf/pylibcudf/table.pyi index 263bf813c75f..fad9f9f4df7c 100644 --- a/python/pylibcudf/pylibcudf/table.pyi +++ b/python/pylibcudf/pylibcudf/table.pyi @@ -1,6 +1,7 @@ -# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +from collections.abc import Sequence from typing import Any from rmm.pylibrmm.memory_resource import DeviceMemoryResource @@ -11,11 +12,12 @@ from pylibcudf.types import DataType from pylibcudf.utils import CudaStreamLike class Table: - def __init__(self, column: list[Column]): ... + def __init__(self, columns: Sequence[Column]): ... def num_columns(self) -> int: ... def num_rows(self) -> int: ... def shape(self) -> tuple[int, int]: ... - def columns(self) -> list[Column]: ... + def columns(self) -> tuple[Column, ...]: ... + def release(self) -> list[Column]: ... def copy( self, stream: CudaStreamLike | None = None, diff --git a/python/pylibcudf/pylibcudf/table.pyx b/python/pylibcudf/pylibcudf/table.pyx index d6b3de8dfeeb..fa83fc00fc74 100644 --- a/python/pylibcudf/pylibcudf/table.pyx +++ b/python/pylibcudf/pylibcudf/table.pyx @@ -64,12 +64,13 @@ cdef class Table: Parameters ---------- - columns : list + columns : Sequence[Column] The columns in this table. """ __hash__ = None - def __init__(self, list columns): + def __init__(self, columns): + columns = tuple(columns) if not all(isinstance(c, Column) for c in columns): raise ValueError("All columns must be pylibcudf Column objects") self._columns = columns @@ -310,10 +311,22 @@ cdef class Table: return 0 return self._columns[0].size() - cpdef list columns(self): + cpdef tuple columns(self): """The columns in this table.""" return self._columns + cpdef list release(self): + """Release ownership of this table's columns and leave it empty. + + Returns + ------- + list + The columns that were in this table. + """ + cdef list columns = list(self._columns) + self._columns = () + return columns + cpdef tuple shape(self): """The shape of this table""" return (self.num_rows(), self.num_columns()) diff --git a/python/pylibcudf/pylibcudf/transform.pxd b/python/pylibcudf/pylibcudf/transform.pxd index 8333abd6df0c..6a558074882c 100644 --- a/python/pylibcudf/pylibcudf/transform.pxd +++ b/python/pylibcudf/pylibcudf/transform.pxd @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 from libcpp cimport bool from pylibcudf.libcudf.types cimport bitmask_type, data_type @@ -41,7 +41,7 @@ cpdef Column mask_to_bools( ) cpdef Column transform( - list[Column] inputs, + inputs, str transform_udf, DataType output_type, bool is_ptx, diff --git a/python/pylibcudf/pylibcudf/transform.pyi b/python/pylibcudf/pylibcudf/transform.pyi index e979575f5906..64c8f24f7e21 100644 --- a/python/pylibcudf/pylibcudf/transform.pyi +++ b/python/pylibcudf/pylibcudf/transform.pyi @@ -1,5 +1,7 @@ -# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +from collections.abc import Sequence + from rmm.pylibrmm.memory_resource import DeviceMemoryResource from pylibcudf.column import Column @@ -44,7 +46,7 @@ def mask_to_bools( mr: DeviceMemoryResource | None = None, ) -> Column: ... def transform( - inputs: list[Column], + inputs: Sequence[Column], transform_udf: str, output_type: DataType, is_ptx: bool, diff --git a/python/pylibcudf/pylibcudf/transform.pyx b/python/pylibcudf/pylibcudf/transform.pyx index bc92959c8d7c..447b8034deab 100644 --- a/python/pylibcudf/pylibcudf/transform.pyx +++ b/python/pylibcudf/pylibcudf/transform.pyx @@ -284,7 +284,7 @@ cpdef Column mask_to_bools( cpdef Column transform( - list[Column] inputs, + inputs, str transform_udf, DataType output_type, bool is_ptx, @@ -298,7 +298,7 @@ cpdef Column transform( Parameters ---------- - inputs : list[Column] + inputs : Sequence[Column] Columns to transform. transform_udf : str The PTX/CUDA string of the transform function to apply.