libcudf  24.04.00
Files | Functions
Factories

Files

file  scalar_factories.hpp
 Scalar factory APIs.
 

Functions

std::unique_ptr< scalarcudf::make_numeric_scalar (data_type type, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct scalar with uninitialized storage to hold a value of the specified numeric data_type. More...
 
std::unique_ptr< scalarcudf::make_timestamp_scalar (data_type type, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct scalar with uninitialized storage to hold a value of the specified timestamp data_type. More...
 
std::unique_ptr< scalarcudf::make_duration_scalar (data_type type, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct scalar with uninitialized storage to hold a value of the specified duration data_type. More...
 
std::unique_ptr< scalarcudf::make_fixed_width_scalar (data_type type, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct scalar with uninitialized storage to hold a value of the specified fixed-width data_type. More...
 
std::unique_ptr< scalarcudf::make_string_scalar (std::string const &string, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct STRING type scalar given a std::string. The size of the std::string must not exceed the maximum size of size_type. The string characters are expected to be UTF-8 encoded sequence of char bytes. More...
 
std::unique_ptr< scalarcudf::make_default_constructed_scalar (data_type type, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Constructs default constructed scalar of type type More...
 
std::unique_ptr< scalarcudf::make_empty_scalar_like (column_view const &input, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Creates an empty (invalid) scalar of the same type as the input column_view. More...
 
template<typename T >
std::unique_ptr< scalarcudf::make_fixed_width_scalar (T value, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct scalar using the given value of fixed width type. More...
 
template<typename T >
std::unique_ptr< scalarcudf::make_fixed_point_scalar (typename T::rep value, numeric::scale_type scale, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct scalar using the given value of fixed_point type. More...
 
std::unique_ptr< scalarcudf::make_list_scalar (column_view elements, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct scalar using the given column of elements. More...
 
std::unique_ptr< scalarcudf::make_struct_scalar (table_view const &data, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct a struct scalar using the given table_view. More...
 
std::unique_ptr< scalarcudf::make_struct_scalar (host_span< column_view const > data, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct a struct scalar using the given span of column views. More...
 

Detailed Description

Function Documentation

◆ make_default_constructed_scalar()

std::unique_ptr<scalar> cudf::make_default_constructed_scalar ( data_type  type,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource *  mr = rmm::mr::get_current_device_resource() 
)

Constructs default constructed scalar of type type

Exceptions
std::bad_allocif device memory allocation fails
Parameters
typeThe desired element type
streamCUDA stream used for device memory operations.
mrDevice memory resource used to allocate the scalar's data and is_valid bool.
Returns
A scalar of type type

◆ make_duration_scalar()

std::unique_ptr<scalar> cudf::make_duration_scalar ( data_type  type,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource *  mr = rmm::mr::get_current_device_resource() 
)

Construct scalar with uninitialized storage to hold a value of the specified duration data_type.

Exceptions
std::bad_allocif device memory allocation fails
cudf::logic_errorif type is not a duration type
Parameters
typeThe desired duration element type
streamCUDA stream used for device memory operations.
mrDevice memory resource used to allocate the scalar's data and is_valid bool.
Returns
An uninitialized duration scalar

◆ make_empty_scalar_like()

std::unique_ptr<scalar> cudf::make_empty_scalar_like ( column_view const &  input,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource *  mr = rmm::mr::get_current_device_resource() 
)

Creates an empty (invalid) scalar of the same type as the input column_view.

Exceptions
cudf::logic_errorif the input column is struct type and empty
Parameters
inputImmutable view of input column to emulate
streamCUDA stream used for device memory operations.
mrDevice memory resource used to allocate the scalar's data and is_valid bool.
Returns
A scalar of type of input column

◆ make_fixed_point_scalar()

template<typename T >
std::unique_ptr<scalar> cudf::make_fixed_point_scalar ( typename T::rep  value,
numeric::scale_type  scale,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource *  mr = rmm::mr::get_current_device_resource() 
)

Construct scalar using the given value of fixed_point type.

Template Parameters
TDatatype of the value to be represented by the scalar
Parameters
valueThe value to store in the scalar object
scaleThe scale of the fixed point value
streamCUDA stream used for device memory operations.
mrDevice memory resource used to allocate the scalar's data and is_valid bool.
Returns
A scalar of type T

Definition at line 176 of file scalar_factories.hpp.

◆ make_fixed_width_scalar() [1/2]

std::unique_ptr<scalar> cudf::make_fixed_width_scalar ( data_type  type,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource *  mr = rmm::mr::get_current_device_resource() 
)

Construct scalar with uninitialized storage to hold a value of the specified fixed-width data_type.

Exceptions
std::bad_allocif device memory allocation fails
cudf::logic_errorif type is not a fixed-width type
Parameters
typeThe desired fixed-width element type
streamCUDA stream used for device memory operations.
mrDevice memory resource used to allocate the scalar's data and is_valid bool.
Returns
An uninitialized fixed-width scalar

◆ make_fixed_width_scalar() [2/2]

template<typename T >
std::unique_ptr<scalar> cudf::make_fixed_width_scalar ( value,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource *  mr = rmm::mr::get_current_device_resource() 
)

Construct scalar using the given value of fixed width type.

Template Parameters
TDatatype of the value to be represented by the scalar
Parameters
valueThe value to store in the scalar object
streamCUDA stream used for device memory operations.
mrDevice memory resource used to allocate the scalar's data and is_valid bool.
Returns
A scalar of type T

Definition at line 157 of file scalar_factories.hpp.

◆ make_list_scalar()

std::unique_ptr<scalar> cudf::make_list_scalar ( column_view  elements,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource *  mr = rmm::mr::get_current_device_resource() 
)

Construct scalar using the given column of elements.

Parameters
elementsElements of the list
streamCUDA stream used for device memory operations.
mrDevice memory resource used to allocate the scalar's data and is_valid bool.
Returns
A list scalar

◆ make_numeric_scalar()

std::unique_ptr<scalar> cudf::make_numeric_scalar ( data_type  type,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource *  mr = rmm::mr::get_current_device_resource() 
)

Construct scalar with uninitialized storage to hold a value of the specified numeric data_type.

Exceptions
std::bad_allocif device memory allocation fails
cudf::logic_errorif type is not a numeric type
Parameters
typeThe desired numeric element type
streamCUDA stream used for device memory operations.
mrDevice memory resource used to allocate the scalar's data and is_valid bool.
Returns
An uninitialized numeric scalar

◆ make_string_scalar()

std::unique_ptr<scalar> cudf::make_string_scalar ( std::string const &  string,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource *  mr = rmm::mr::get_current_device_resource() 
)

Construct STRING type scalar given a std::string. The size of the std::string must not exceed the maximum size of size_type. The string characters are expected to be UTF-8 encoded sequence of char bytes.

Exceptions
std::bad_allocif device memory allocation fails
Parameters
stringThe std::string to copy to device
streamCUDA stream used for device memory operations.
mrDevice memory resource used to allocate the scalar's data and is_valid bool.
Returns
A string scalar with the contents of string

◆ make_struct_scalar() [1/2]

std::unique_ptr<scalar> cudf::make_struct_scalar ( host_span< column_view const >  data,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource *  mr = rmm::mr::get_current_device_resource() 
)

Construct a struct scalar using the given span of column views.

The columns must have 1 row.

Parameters
dataThe columnar data to store in the scalar object
streamCUDA stream used for device memory operations.
mrDevice memory resource used to allocate the scalar's data and is_valid bool.
Returns
A struct scalar

◆ make_struct_scalar() [2/2]

std::unique_ptr<scalar> cudf::make_struct_scalar ( table_view const &  data,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource *  mr = rmm::mr::get_current_device_resource() 
)

Construct a struct scalar using the given table_view.

The columns must have 1 row.

Parameters
dataThe columnar data to store in the scalar object
streamCUDA stream used for device memory operations.
mrDevice memory resource used to allocate the scalar's data and is_valid bool.
Returns
A struct scalar

◆ make_timestamp_scalar()

std::unique_ptr<scalar> cudf::make_timestamp_scalar ( data_type  type,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource *  mr = rmm::mr::get_current_device_resource() 
)

Construct scalar with uninitialized storage to hold a value of the specified timestamp data_type.

Exceptions
std::bad_allocif device memory allocation fails
cudf::logic_errorif type is not a timestamp type
Parameters
typeThe desired timestamp element type
streamCUDA stream used for device memory operations.
mrDevice memory resource used to allocate the scalar's data and is_valid bool.
Returns
An uninitialized timestamp scalar