From 8f69dbf6eb84f518150f47a81f9605642bbff837 Mon Sep 17 00:00:00 2001 From: Jim Pivarski Date: Thu, 5 Dec 2024 16:02:15 -0600 Subject: [PATCH] fix: Upstream API changes in cuDF 24.10 (#3328) This is an exact copy of PR #3309, which was closed in favor of this one (to avoid issues with the `rapidjson` submodule). --- src/awkward/contents/listoffsetarray.py | 5 +++-- src/awkward/operations/ak_to_cudf.py | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/awkward/contents/listoffsetarray.py b/src/awkward/contents/listoffsetarray.py index 9367810539..030d35a344 100644 --- a/src/awkward/contents/listoffsetarray.py +++ b/src/awkward/contents/listoffsetarray.py @@ -2013,7 +2013,7 @@ def _to_cudf(self, cudf: Any, mask: Content | None, length: int): index = self._offsets.raw(cupy).astype("int32") buf = cudf.core.buffer.as_buffer(index) ind_buf = cudf.core.column.numerical.NumericalColumn( - buf, index.dtype, None, size=len(index) + data=buf, dtype=index.dtype, mask=None, size=len(index) ) cont = self._content._to_cudf(cudf, None, len(self._content)) if mask is not None: @@ -2035,7 +2035,8 @@ def _to_cudf(self, cudf: Any, mask: Content | None, length: int): ) return cudf.core.column.lists.ListColumn( - length, + size=length, + data=None, mask=m, children=(ind_buf, cont), dtype=cudf.core.dtypes.ListDtype(cont.dtype), diff --git a/src/awkward/operations/ak_to_cudf.py b/src/awkward/operations/ak_to_cudf.py index e45fe041a2..d2692c6252 100644 --- a/src/awkward/operations/ak_to_cudf.py +++ b/src/awkward/operations/ak_to_cudf.py @@ -18,4 +18,7 @@ def to_cudf( """ import cudf + if hasattr(cudf.Series, "_from_column"): + return cudf.Series._from_column(array.layout._to_cudf(cudf, None, len(array))) + # older Series invocation return cudf.Series(array.layout._to_cudf(cudf, None, len(array)))