Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cudf::scalar Class Reference

An owning class to represent a singular value. More...

#include <scalar.hpp>

Inheritance diagram for cudf::scalar:
cudf::detail::fixed_width_scalar< T > cudf::fixed_point_scalar< T > cudf::string_scalar cudf::chrono_scalar< T > cudf::numeric_scalar< T > cudf::duration_scalar< T > cudf::timestamp_scalar< T >

Public Member Functions

 scalar (scalar &&other)=default
 
 scalar (scalar const &other)=default
 
scalaroperator= (scalar const &other)=delete
 
scalaroperator= (scalar &&other)=delete
 
data_type type () const noexcept
 Returns the scalar's logical value type.
 
void set_valid (bool is_valid, rmm::cuda_stream_view stream=rmm::cuda_stream_default)
 Updates the validity of the value. More...
 
bool is_valid (rmm::cuda_stream_view stream=rmm::cuda_stream_default) const
 Indicates whether the scalar contains a valid value. More...
 
bool * validity_data ()
 Returns a raw pointer to the validity bool in device memory.
 
bool const * validity_data () const
 Returns a const raw pointer to the validity bool in device memory.
 

Protected Member Functions

 scalar (data_type type, bool is_valid=false, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct a new scalar object. More...
 

Protected Attributes

data_type _type {type_id::EMPTY}
 Logical type of value in the scalar.
 
rmm::device_scalar< bool > _is_valid {}
 Device bool signifying validity.
 

Detailed Description

An owning class to represent a singular value.

A scalar is a singular value of any of the supported datatypes in cudf. Classes derived from this class are used to represent a scalar. Objects of derived classes should be upcasted to this class while passing to an external libcudf API.

Definition at line 51 of file scalar.hpp.

Constructor & Destructor Documentation

◆ scalar()

cudf::scalar::scalar ( data_type  type,
bool  is_valid = false,
rmm::cuda_stream_view  stream = rmm::cuda_stream_default,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)
inlineprotected

Construct a new scalar object.

Note
Do not use this constructor directly. Instead, use a factory method like make_numeric_scalar or make_string_scalar
Parameters
[in]typeData type of the scalar
[in]is_validWhether the value held by the scalar is valid
[in]streamCUDA stream used for device memory operations.
[in]mrDevice memory resource to use for device memory allocation

Definition at line 116 of file scalar.hpp.

Member Function Documentation

◆ is_valid()

bool cudf::scalar::is_valid ( rmm::cuda_stream_view  stream = rmm::cuda_stream_default) const
inline

Indicates whether the scalar contains a valid value.

Note
Using the value when is_valid() == false is undefined behaviour
Parameters
streamCUDA stream used for device memory operations.
Returns
true Value is valid
false Value is invalid/null

Definition at line 84 of file scalar.hpp.

◆ set_valid()

void cudf::scalar::set_valid ( bool  is_valid,
rmm::cuda_stream_view  stream = rmm::cuda_stream_default 
)
inline

Updates the validity of the value.

Parameters
is_validtrue: set the value to valid. false: set it to null
streamCUDA stream used for device memory operations.

Definition at line 70 of file scalar.hpp.


The documentation for this class was generated from the following file: