Public Member Functions | Static Public Member Functions | List of all members
cudf::test::lists_column_wrapper< T, SourceElementT > Class Template Reference

column_wrapper derived class for wrapping columns of lists. More...

#include <column_wrapper.hpp>

Inheritance diagram for cudf::test::lists_column_wrapper< T, SourceElementT >:
cudf::test::detail::column_wrapper

Public Member Functions

 operator lists_column_view () const
 Cast to lists_column_view.
 
template<typename Element = T, std::enable_if_t< cudf::is_fixed_width< Element >()> * = nullptr>
 lists_column_wrapper (std::initializer_list< SourceElementT > elements)
 Construct a lists column containing a single list of fixed-width type from an initializer list of values. More...
 
template<typename Element = T, typename InputIterator , std::enable_if_t< cudf::is_fixed_width< Element >()> * = nullptr>
 lists_column_wrapper (InputIterator begin, InputIterator end)
 Construct a lists column containing a single list of fixed-width type from an iterator range. More...
 
template<typename Element = T, typename ValidityIterator , std::enable_if_t< cudf::is_fixed_width< Element >()> * = nullptr>
 lists_column_wrapper (std::initializer_list< SourceElementT > elements, ValidityIterator v)
 Construct a lists column containing a single list of fixed-width type from an initializer list of values and a validity iterator. More...
 
template<typename Element = T, typename InputIterator , typename ValidityIterator , std::enable_if_t< cudf::is_fixed_width< Element >()> * = nullptr>
 lists_column_wrapper (InputIterator begin, InputIterator end, ValidityIterator v)
 Construct a lists column containing a single list of fixed-width type from an iterator range and a validity iterator. More...
 
template<typename Element = T, std::enable_if_t< std::is_same_v< Element, cudf::string_view >> * = nullptr>
 lists_column_wrapper (std::initializer_list< std::string > elements)
 Construct a lists column containing a single list of strings from an initializer list of values. More...
 
template<typename Element = T, typename ValidityIterator , std::enable_if_t< std::is_same_v< Element, cudf::string_view >> * = nullptr>
 lists_column_wrapper (std::initializer_list< std::string > elements, ValidityIterator v)
 Construct a lists column containing a single list of strings from an initializer list of values and a validity iterator. More...
 
 lists_column_wrapper (std::initializer_list< lists_column_wrapper< T, SourceElementT >> elements)
 Construct a lists column of nested lists from an initializer list of values. More...
 
 lists_column_wrapper ()
 Construct am empty lists column. More...
 
template<typename ValidityIterator >
 lists_column_wrapper (std::initializer_list< lists_column_wrapper< T, SourceElementT >> elements, ValidityIterator v)
 Construct a lists column of nested lists from an initializer list of values and a validity iterator. More...
 
- Public Member Functions inherited from cudf::test::detail::column_wrapper
 operator column_view () const
 Implicit conversion operator to column_view. More...
 
 operator mutable_column_view ()
 Implicit conversion operator to mutable_column_view. More...
 
std::unique_ptr< cudf::columnrelease ()
 Releases internal unique_ptr to wrapped column. More...
 

Static Public Member Functions

static lists_column_wrapper< T > make_one_empty_row_column (bool valid=true)
 Construct a list column containing a single empty, optionally null row. More...
 

Additional Inherited Members

- Protected Attributes inherited from cudf::test::detail::column_wrapper
std::unique_ptr< cudf::columnwrapped {}
 The wrapped column.
 

Detailed Description

template<typename T, typename SourceElementT = T>
class cudf::test::lists_column_wrapper< T, SourceElementT >

column_wrapper derived class for wrapping columns of lists.

Important note : due to the way initializer lists work, there is a non-obvious behavioral difference when declaring nested empty lists in different situations. Specifically,

lists_column_wrapper<int> col{ {LCW{}} }
This yields a List<List<int>> column containing 1 row : a list
containing an empty list.
lists_column_wrapper<int> col{ {LCW{}} }
This yields a List<int> column containing 1 row that is an empty
list.

This only effects the initial nesting of the empty list. In summary, the correct way to declare an "Empty List" in the two cases are:

// situation 1 (cudf TYPED_TEST case)
LCW{}
// situation 2 (cudf TEST_F case)
{LCW{}}

Definition at line 1316 of file column_wrapper.hpp.

Constructor & Destructor Documentation

◆ lists_column_wrapper() [1/9]

template<typename T , typename SourceElementT = T>
template<typename Element = T, std::enable_if_t< cudf::is_fixed_width< Element >()> * = nullptr>
cudf::test::lists_column_wrapper< T, SourceElementT >::lists_column_wrapper ( std::initializer_list< SourceElementT >  elements)
inline

Construct a lists column containing a single list of fixed-width type from an initializer list of values.

Example:

Creates a LIST column with 1 list composed of 2 total integers
[{0, 1}]
lists_column_wrapper()
Construct am empty lists column.
Parameters
elementsThe list of elements

Definition at line 1337 of file column_wrapper.hpp.

◆ lists_column_wrapper() [2/9]

template<typename T , typename SourceElementT = T>
template<typename Element = T, typename InputIterator , std::enable_if_t< cudf::is_fixed_width< Element >()> * = nullptr>
cudf::test::lists_column_wrapper< T, SourceElementT >::lists_column_wrapper ( InputIterator  begin,
InputIterator  end 
)
inline

Construct a lists column containing a single list of fixed-width type from an iterator range.

Example:

// Creates a LIST column with 1 list composed of 5 total integers
auto elements = make_counting_transform_iterator(0, [](auto i){return i*2;});
// [{0, 1, 2, 3, 4}]
lists_column_wrapper l(elements, elements+5);
Parameters
beginBeginning of the sequence
endEnd of the sequence

Definition at line 1361 of file column_wrapper.hpp.

◆ lists_column_wrapper() [3/9]

template<typename T , typename SourceElementT = T>
template<typename Element = T, typename ValidityIterator , std::enable_if_t< cudf::is_fixed_width< Element >()> * = nullptr>
cudf::test::lists_column_wrapper< T, SourceElementT >::lists_column_wrapper ( std::initializer_list< SourceElementT >  elements,
ValidityIterator  v 
)
inline

Construct a lists column containing a single list of fixed-width type from an initializer list of values and a validity iterator.

Example:

// Creates a LIST column with 1 lists composed of 2 total integers
auto validity = make_counting_transform_iterator(0, [](auto i){return i%2;});
// [{0, NULL}]
lists_column_wrapper l{{0, 1}, validity};
Parameters
elementsThe list of elements
vThe validity iterator

Definition at line 1385 of file column_wrapper.hpp.

◆ lists_column_wrapper() [4/9]

template<typename T , typename SourceElementT = T>
template<typename Element = T, typename InputIterator , typename ValidityIterator , std::enable_if_t< cudf::is_fixed_width< Element >()> * = nullptr>
cudf::test::lists_column_wrapper< T, SourceElementT >::lists_column_wrapper ( InputIterator  begin,
InputIterator  end,
ValidityIterator  v 
)
inline

Construct a lists column containing a single list of fixed-width type from an iterator range and a validity iterator.

Example:

// Creates a LIST column with 1 lists composed of 5 total integers
auto elements = make_counting_transform_iterator(0, [](auto i){return i*2;});
auto validity = make_counting_transform_iterator(0, [](auto i){return i%2;});
// [{0, NULL, 2, NULL, 4}]
lists_column_wrapper l(elements, elements+5, validity);
Parameters
beginBeginning of the sequence
endEnd of the sequence
vThe validity iterator

Definition at line 1413 of file column_wrapper.hpp.

◆ lists_column_wrapper() [5/9]

template<typename T , typename SourceElementT = T>
template<typename Element = T, std::enable_if_t< std::is_same_v< Element, cudf::string_view >> * = nullptr>
cudf::test::lists_column_wrapper< T, SourceElementT >::lists_column_wrapper ( std::initializer_list< std::string >  elements)
inline

Construct a lists column containing a single list of strings from an initializer list of values.

Example:

// Creates a LIST column with 1 list composed of 2 total strings
// [{"abc", "def"}]
lists_column_wrapper l{"abc", "def"};
Parameters
elementsThe list of elements

Definition at line 1435 of file column_wrapper.hpp.

◆ lists_column_wrapper() [6/9]

template<typename T , typename SourceElementT = T>
template<typename Element = T, typename ValidityIterator , std::enable_if_t< std::is_same_v< Element, cudf::string_view >> * = nullptr>
cudf::test::lists_column_wrapper< T, SourceElementT >::lists_column_wrapper ( std::initializer_list< std::string >  elements,
ValidityIterator  v 
)
inline

Construct a lists column containing a single list of strings from an initializer list of values and a validity iterator.

Example:

// Creates a LIST column with 1 list composed of 2 total strings
auto validity = make_counting_transform_iterator(0, [](auto i){return i%2;});
// [{"abc", NULL}]
lists_column_wrapper l{{"abc", "def"}, validity};
Parameters
elementsThe list of elements
vThe validity iterator

Definition at line 1459 of file column_wrapper.hpp.

◆ lists_column_wrapper() [7/9]

template<typename T , typename SourceElementT = T>
cudf::test::lists_column_wrapper< T, SourceElementT >::lists_column_wrapper ( std::initializer_list< lists_column_wrapper< T, SourceElementT >>  elements)
inline

Construct a lists column of nested lists from an initializer list of values.

Example:

// Creates a LIST column with 3 lists
// [{0, 1}, {2, 3}, {4, 5}]
lists_column_wrapper l{ {0, 1}, {2, 3}, {4, 5} };

Automatically handles nesting Example:

// Creates a LIST of LIST columns with 2 lists on the top level and
// 4 below
// [ {{0, 1}, {2, 3}}, {{4, 5}, {6, 7}} ]
lists_column_wrapper l{ {{0, 1}, {2, 3}}, {{4, 5}, {6, 7}} };
Parameters
elementsThe list of elements

Definition at line 1487 of file column_wrapper.hpp.

◆ lists_column_wrapper() [8/9]

template<typename T , typename SourceElementT = T>
cudf::test::lists_column_wrapper< T, SourceElementT >::lists_column_wrapper ( )
inline

Construct am empty lists column.

Example:

// Creates an empty LIST column
// []

Definition at line 1505 of file column_wrapper.hpp.

◆ lists_column_wrapper() [9/9]

template<typename T , typename SourceElementT = T>
template<typename ValidityIterator >
cudf::test::lists_column_wrapper< T, SourceElementT >::lists_column_wrapper ( std::initializer_list< lists_column_wrapper< T, SourceElementT >>  elements,
ValidityIterator  v 
)
inline

Construct a lists column of nested lists from an initializer list of values and a validity iterator.

Example:

// Creates a LIST column with 3 lists
auto validity = make_counting_transform_iterator(0, [](auto i){return i%2;});
// [{0, 1}, NULL, {4, 5}]
lists_column_wrapper l{ {{0, 1}, {2, 3}, {4, 5}, validity} };

Automatically handles nesting Example:

// Creates a LIST of LIST columns with 2 lists on the top level and
// 4 below
auto validity = make_counting_transform_iterator(0, [](auto i){return i%2;});
// [ {{0, 1}, NULL}, {{4, 5}, NULL} ]
lists_column_wrapper l{ {{{0, 1}, {2, 3}}, validity}, {{{4, 5}, {6, 7}}, validity} };
Parameters
elementsThe list of elements
vThe validity iterator

Definition at line 1536 of file column_wrapper.hpp.

Member Function Documentation

◆ make_one_empty_row_column()

template<typename T , typename SourceElementT = T>
static lists_column_wrapper<T> cudf::test::lists_column_wrapper< T, SourceElementT >::make_one_empty_row_column ( bool  valid = true)
inlinestatic

Construct a list column containing a single empty, optionally null row.

Parameters
validWhether or not the empty row is also null
Returns
A list column containing a single empty row

Definition at line 1555 of file column_wrapper.hpp.


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