NVIDIA / NVIDIA/cudf

[FEA] Support "mask" entries in `pylibcudf.Column.from_(cuda)_array_interface`

Open
#19,122 0 comments 0 reactions 0 assignees View on GitHub
feature request pylibcudf Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

**Is your feature request related to a problem? Please describe.**
Currently cuDF classic allows parsing a `__cuda_array_interface__` with a `"mask"` entry:

```python
def _mask_from_cuda_array_interface_desc(obj, cai_mask) -> Buffer:
desc = cai_mask.__cuda_array_interface__
typestr = desc["typestr"]
typecode = typestr[1]
if typecode == "t":
mask_size = plc.null_mask.bitmask_allocation_size_bytes(
desc["shape"][0]
)
return as_buffer(data=desc["data"][0], size=mask_size, owner=obj)
elif typecode == "b":
return as_column(cai_mask).as_mask()
else:
raise NotImplementedError(f"Cannot infer mask from typestr {typestr}")
```

**Describe the solution you'd like**
It would be nice if this could be integrated directly into pylibcudf to avoid a current workaround where this mask is "popped" from the original interface object and processed separately.

This ideally should be extended to `__array_interface__` as well.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.