Skip to content

Commit

Permalink
strings_udf lowering shall not import cudf, and functions shall be at…
Browse files Browse the repository at this point in the history
…trs of string_view
  • Loading branch information
brandon-b-miller committed Jul 21, 2022
1 parent 35d238b commit cc661b3
Show file tree
Hide file tree
Showing 19 changed files with 229 additions and 236 deletions.
6 changes: 0 additions & 6 deletions python/cudf/cudf/core/udf/masked_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ def __init__(self, value):
if isinstance(value, (types.PyObject, StringView)):
self.value_type = string_view

from strings_udf import lowering
from strings_udf._lib.cudf_jit_udf import get_character_flags_table_ptr

character_flags_table_ptr = get_character_flags_table_ptr()
lowering.character_flags_table_ptr = character_flags_table_ptr

elif isinstance(value, SUPPORTED_NUMBA_TYPES):
self.value_type = value
else:
Expand Down
7 changes: 0 additions & 7 deletions python/strings_udf/strings_udf/_lib/cudf_jit_udf.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ from strings_udf._lib.cpp.strings_udf cimport (
from_dstring_array as cpp_from_dstring_array,
to_string_view_array as cpp_to_string_view_array,
udf_module as cpp_udf_module,
get_character_flags_table as cpp_get_character_flags_table
)

from libc.stdint cimport uintptr_t, uint8_t

import numpy as np

def process_udf( udf, name, cols ):
Expand Down Expand Up @@ -86,7 +83,3 @@ def from_dstring_array(DeviceBuffer d_buffer):
c_result = move(cpp_from_dstring_array(data, size))

return Column.from_unique_ptr(move(c_result))

def get_character_flags_table_ptr():
cdef const uint8_t* tbl_ptr = cpp_get_character_flags_table()
return np.int64(<uintptr_t>tbl_ptr)
13 changes: 13 additions & 0 deletions python/strings_udf/strings_udf/_lib/tables.pyx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2022, NVIDIA CORPORATION.
#
# distutils: language = c++
# cython: c_string_type=unicode, c_string_encoding=utf8

from strings_udf._lib.cpp.strings_udf cimport get_character_flags_table as cpp_get_character_flags_table
from libc.stdint cimport uintptr_t, uint8_t
import numpy as np


def get_character_flags_table_ptr():
cdef const uint8_t* tbl_ptr = cpp_get_character_flags_table()
return np.int64(<uintptr_t>tbl_ptr)
Loading

0 comments on commit cc661b3

Please sign in to comment.