Skip to content

Commit b0c03b3

Browse files
committed
Correctly determine size of strings column view
Can't unilaterally use int32 offsets.
1 parent a3ef778 commit b0c03b3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

python/pylibcudf/pylibcudf/column.pyx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ from cpython.pycapsule cimport (
88
)
99

1010
from libc.stddef cimport size_t
11-
from libc.stdint cimport uintptr_t
11+
from libc.stdint cimport uintptr_t, int32_t, int64_t
1212

1313
from libcpp.limits cimport numeric_limits
1414
from libcpp.memory cimport make_unique, unique_ptr
@@ -102,7 +102,12 @@ cdef class OwnerWithCAI:
102102
if num_children:
103103
offsets_column = cv.child(0)
104104
last_offset = get_element(offsets_column, offsets_column.size() - 1)
105-
size = (<numeric_scalar[size_type] *> last_offset.get()).value()
105+
if offsets_column.type().id() == type_id.INT32:
106+
size = (<numeric_scalar[int32_t] *> last_offset.get()).value()
107+
elif offsets_column.type().id() == type_id.INT64:
108+
size = (<numeric_scalar[int64_t] *>last_offset.get()).value()
109+
else:
110+
raise RuntimeError("Invalid strings column offset dtype")
106111
else:
107112
# All other types store data in the children, so the parent size is 0
108113
size = 0

0 commit comments

Comments
 (0)