From 467cf7a7c0a248bdba34e48fc8932acff5797016 Mon Sep 17 00:00:00 2001 From: Matthew Murray <41342305+Matt711@users.noreply.github.com> Date: Fri, 6 Dec 2024 14:06:08 -0500 Subject: [PATCH] Replaces uses of `cudf._lib.Column.from_unique_ptr` with `pylibcudf.Column.from_libcudf` (#17517) Apart of #15162. In a follow-up PR we'll deprecate the cudf python column APIs and others that are used outside cudf. Authors: - Matthew Murray (https://github.com/Matt711) Approvers: - Matthew Roeschke (https://github.com/mroeschke) URL: https://github.com/rapidsai/cudf/pull/17517 --- python/cudf/cudf/_lib/strings_udf.pyx | 8 ++++---- python/cudf/cudf/_lib/utils.pyx | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/python/cudf/cudf/_lib/strings_udf.pyx b/python/cudf/cudf/_lib/strings_udf.pyx index dd2fafbe07f..83f0cb850a5 100644 --- a/python/cudf/cudf/_lib/strings_udf.pyx +++ b/python/cudf/cudf/_lib/strings_udf.pyx @@ -1,7 +1,6 @@ # Copyright (c) 2022-2024, NVIDIA CORPORATION. from libc.stdint cimport uint8_t, uint16_t, uintptr_t - from pylibcudf.libcudf.strings_udf cimport ( get_character_cases_table as cpp_get_character_cases_table, get_character_flags_table as cpp_get_character_flags_table, @@ -27,6 +26,7 @@ from rmm.librmm.device_buffer cimport device_buffer from rmm.pylibrmm.device_buffer cimport DeviceBuffer from cudf._lib.column cimport Column +from pylibcudf cimport Column as plc_Column def get_cuda_build_version(): @@ -52,9 +52,9 @@ def column_from_udf_string_array(DeviceBuffer d_buffer): c_result = move(cpp_column_from_udf_string_array(data, size)) cpp_free_udf_string_array(data, size) - result = Column.from_unique_ptr(move(c_result)) - - return result + return Column.from_pylibcudf( + plc_Column.from_libcudf(move(c_result)) + ) def get_character_flags_table_ptr(): diff --git a/python/cudf/cudf/_lib/utils.pyx b/python/cudf/cudf/_lib/utils.pyx index 6b3f10e1806..ff032656f80 100644 --- a/python/cudf/cudf/_lib/utils.pyx +++ b/python/cudf/cudf/_lib/utils.pyx @@ -16,7 +16,7 @@ from pylibcudf.libcudf.table.table_view cimport table_view from pylibcudf.libcudf.types cimport size_type from cudf._lib.column cimport Column - +from pylibcudf cimport Column as plc_Column try: import ujson as json except ImportError: @@ -223,10 +223,11 @@ cdef columns_from_unique_ptr( cdef size_t i - columns = [Column.from_unique_ptr(move(dereference(it+i))) - for i in range(c_columns.size())] - - return columns + return [ + Column.from_pylibcudf( + plc_Column.from_libcudf(move(dereference(it+i))) + ) for i in range(c_columns.size()) + ] cpdef columns_from_pylibcudf_table(tbl):