NVIDIA / NVIDIA/cudf

[BUG] `get_scalar_device_view` doesn't support `const scalar`

Open
#4,365 9 comments 0 reactions 0 assignees View on GitHub
bug feature request libcudf
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

**Describe the bug**

In order to use a scalar in device code, you have to use [`get_scalar_device_view`](https://github.com/rapidsai/cudf/blob/1ead2d55562b9cd1b80568b86b8b51ab616f3cb8/cpp/include/cudf/scalar/scalar_device_view.cuh#L194). The problem is, `get_scalar_device_view` takes a `scalar` by non-const ref, which means if your scalar is a `const`, then you have to do a `const_cast` to cast away the constness, which invokes undefined behavior. This is bad.

**Expected behavior**

I shouldn't have to `const_cast` to use `get_scalar_device_view` with a const scalar.

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.