NVIDIA / NVIDIA/cudf

[FEA] Add a sentinel `constexpr` value to denote `INVALID_INDEX`

Open
#9,426 3 comments 1 reaction 0 assignees View on GitHub
feature request improvement libcudf non-breaking
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

Currently, various cudf APIs need to use a special constant to denote an **invalid** row index for certain operations. However, there is not any guideline on what constant should be used to mark an invalid index row. Therefore, different APIs implement their own `INVALID_INDEX` constant.

For example:
* `lists/explode.cu`: `constexpr size_type InvalidIndex = -1;`
* `detail/scatter.cuh`: `std::numeric_limits::lowest()` is used
* `lists/extract.cu`: `std::numeric_limits::max()` is used

And maybe more. As such, the constants used for `INVALID_INDEX` is not agreed across cudf development. We should explicitly add a sentinel constant in some of cudf main header and replace the existing ones with it. By doing so, we can enforce consistency and reduce confusion (why this file uses `-1` while other file uses `numeric_limit::lowest()` or `numeric_limit::max()`).

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.