8 #include <cudf_test/column_utilities.hpp>
9 #include <cudf_test/default_stream.hpp>
14 #include <cudf/detail/concatenate.hpp>
15 #include <cudf/detail/iterator.cuh>
16 #include <cudf/detail/utilities/vector_factories.hpp>
24 #include <cudf/utilities/export.hpp>
31 #include <cuda/std/functional>
32 #include <thrust/copy.h>
33 #include <thrust/host_vector.h>
34 #include <thrust/iterator/constant_iterator.h>
35 #include <thrust/iterator/counting_iterator.h>
36 #include <thrust/iterator/transform_iterator.h>
43 namespace CUDF_EXPORT
cudf {
79 std::unique_ptr<cudf::column>
release() {
return std::move(wrapped); }
82 std::unique_ptr<cudf::column> wrapped{};
88 template <
typename From,
typename To>
98 template <
typename FromT = From,
100 std::enable_if_t<std::is_same_v<FromT, ToT>,
void>* =
nullptr>
115 typename FromT = From,
118 std::is_constructible_v<ToT, FromT>),
120 constexpr ToT
operator()(FromT element)
const
122 return static_cast<ToT
>(element);
134 typename FromT = From,
136 std::enable_if_t<std::is_integral_v<FromT> && cudf::is_timestamp<ToT>(),
void>* =
nullptr>
139 return ToT{
typename ToT::duration{element}};
153 template <
typename ElementTo,
154 typename ElementFrom,
155 typename InputIterator,
156 std::enable_if_t<not cudf::is_fixed_point<ElementTo>()>* =
nullptr>
159 static_assert(cudf::is_fixed_width<ElementTo>(),
"Unexpected non-fixed width type.");
160 auto transformer = fixed_width_type_converter<ElementFrom, ElementTo>{};
161 auto transform_begin = thrust::make_transform_iterator(begin, transformer);
163 auto const elements = thrust::host_vector<ElementTo>(transform_begin, transform_begin + size);
182 template <
typename ElementTo,
183 typename ElementFrom,
184 typename InputIterator,
185 std::enable_if_t<not cudf::is_fixed_point<ElementFrom>() and
187 rmm::device_buffer make_elements(InputIterator begin, InputIterator end)
189 using RepType =
typename ElementTo::rep;
190 auto transformer = fixed_width_type_converter<ElementFrom, RepType>{};
191 auto transform_begin = thrust::make_transform_iterator(begin, transformer);
193 auto const elements = thrust::host_vector<RepType>(transform_begin, transform_begin + size);
208 template <
typename ElementTo,
209 typename ElementFrom,
210 typename InputIterator,
211 std::enable_if_t<cudf::is_fixed_point<ElementFrom>() and
213 rmm::device_buffer make_elements(InputIterator begin, InputIterator end)
216 using RepType =
typename ElementTo::rep;
218 CUDF_EXPECTS(std::all_of(begin, end, [](ElementFrom v) {
return v.scale() == 0; }),
219 "Only zero-scale fixed-point values are supported");
221 auto to_rep = [](ElementTo fp) {
return fp.value(); };
222 auto transformer_begin = thrust::make_transform_iterator(begin, to_rep);
224 auto const elements = thrust::host_vector<RepType>(transformer_begin, transformer_begin + size);
243 template <
typename Val
idityIterator>
244 std::pair<std::vector<bitmask_type>,
cudf::size_type> make_null_mask_vector(ValidityIterator begin,
245 ValidityIterator end)
250 auto null_mask = std::vector<bitmask_type>(num_words, 0);
252 for (
auto i = 0; i < size; ++i) {
276 template <
typename Val
idityIterator>
277 std::pair<rmm::device_buffer, cudf::size_type> make_null_mask(ValidityIterator begin,
278 ValidityIterator end)
280 auto [null_mask,
null_count] = make_null_mask_vector(begin, end);
301 template <
typename StringsIterator,
typename Val
idityIterator>
302 auto make_chars_and_offsets(StringsIterator begin, StringsIterator end, ValidityIterator v)
304 std::vector<char> chars{};
305 std::vector<cudf::size_type> offsets(1, 0);
306 for (
auto str = begin; str < end; ++str) {
307 std::string tmp = (*v++) ? std::string(*str) : std::string{};
308 chars.insert(chars.end(), std::cbegin(tmp), std::cend(tmp));
309 auto const last_offset =
static_cast<std::size_t
>(offsets.back());
310 auto const next_offset = last_offset + tmp.length();
312 next_offset <
static_cast<std::size_t
>(std::numeric_limits<cudf::size_type>::max()),
313 "Cannot use strings_column_wrapper to build a large strings column");
316 return std::pair(std::move(chars), std::move(offsets));
328 template <
typename ElementTo,
typename SourceElementT = ElementTo>
336 std::vector<ElementTo> empty;
340 detail::make_elements<ElementTo, SourceElementT>(empty.begin(), empty.end()),
363 template <
typename InputIterator>
369 detail::make_elements<ElementTo, SourceElementT>(begin, end),
397 template <
typename InputIterator,
typename Val
idityIterator>
402 auto [null_mask,
null_count] = detail::make_null_mask(v, v + size);
405 detail::make_elements<ElementTo, SourceElementT>(begin, end),
406 std::move(null_mask),
422 template <
typename ElementFrom>
445 template <
typename ElementFrom>
447 std::initializer_list<bool> validity)
469 template <
typename Val
idityIterator,
typename ElementFrom>
493 template <
typename InputIterator>
496 std::initializer_list<bool>
const& validity)
518 template <
typename ElementFrom>
522 thrust::make_transform_iterator(elements.begin(), [](
auto const& e) { return e.first; });
523 auto end = begin + elements.size();
525 thrust::make_transform_iterator(elements.begin(), [](
auto const& e) { return e.second; });
535 template <
typename Rep>
554 template <
typename FixedPo
intRepIterator>
556 FixedPointRepIterator end,
560 CUDF_EXPECTS(numeric::is_supported_representation_type<Rep>(),
"not valid representation type");
563 auto const elements = thrust::host_vector<Rep>(begin, end);
564 auto const id = type_to_id<numeric::fixed_point<Rep, numeric::Radix::BASE_10>>();
619 template <
typename FixedPo
intRepIterator,
typename Val
idityIterator>
621 FixedPointRepIterator end,
626 CUDF_EXPECTS(numeric::is_supported_representation_type<Rep>(),
"not valid representation type");
629 auto const elements = thrust::host_vector<Rep>(begin, end);
630 auto const id = type_to_id<numeric::fixed_point<Rep, numeric::Radix::BASE_10>>();
632 auto [null_mask,
null_count] = detail::make_null_mask(v, v + size);
637 std::move(null_mask),
659 std::initializer_list<bool> validity,
662 std::cbegin(elements), std::cend(elements), std::cbegin(validity), scale)
684 template <
typename Val
idityIterator>
712 template <
typename FixedPo
intRepIterator>
714 FixedPointRepIterator end,
715 std::initializer_list<bool>
const& validity,
752 template <
typename StringsIterator>
756 if (num_strings == 0) {
760 auto all_valid = thrust::make_constant_iterator(
true);
761 auto [chars, offsets] = detail::make_chars_and_offsets(begin, end, all_valid);
762 auto d_chars = cudf::detail::make_device_uvector_async(
764 auto d_offsets = std::make_unique<cudf::column>(
765 cudf::detail::make_device_uvector(
801 template <
typename StringsIterator,
typename Val
idityIterator>
806 if (num_strings == 0) {
810 auto [chars, offsets] = detail::make_chars_and_offsets(begin, end, v);
811 auto [null_mask,
null_count] = detail::make_null_mask_vector(v, v + num_strings);
812 auto d_chars = cudf::detail::make_device_uvector_async(
814 auto d_offsets = std::make_unique<cudf::column>(
815 cudf::detail::make_device_uvector_async(
819 auto d_bitmask = cudf::detail::make_device_uvector(
822 num_strings, std::move(d_offsets), d_chars.release(),
null_count, d_bitmask.release());
860 template <
typename Val
idityIterator>
882 std::initializer_list<bool> validity)
910 thrust::make_transform_iterator(strings.begin(), [](
auto const& s) { return s.first; });
911 auto end = begin + strings.size();
913 thrust::make_transform_iterator(strings.begin(), [](
auto const& s) { return s.second; });
926 template <
typename KeyElementTo,
typename SourceElementT = KeyElementTo>
961 template <
typename InputIterator>
995 template <
typename InputIterator,
typename Val
idityIterator>
1018 template <
typename ElementFrom>
1042 template <
typename ElementFrom>
1044 std::initializer_list<bool> validity)
1067 template <
typename Val
idityIterator,
typename ElementFrom>
1093 template <
typename InputIterator>
1096 std::initializer_list<bool>
const& validity)
1161 template <
typename StringsIterator>
1197 template <
typename StringsIterator,
typename Val
idityIterator>
1241 template <
typename Val
idityIterator>
1263 std::initializer_list<bool> validity)
1304 template <
typename T,
typename SourceElementT = T>
1325 template <typename Element = T, std::enable_if_t<cudf::is_fixed_width<Element>()>* =
nullptr>
1328 build_from_non_nested(
1347 template <
typename Element = T,
1348 typename InputIterator,
1349 std::enable_if_t<cudf::is_fixed_width<Element>()>* =
nullptr>
1352 build_from_non_nested(
1371 template <
typename Element = T,
1372 typename ValidityIterator,
1373 std::enable_if_t<cudf::is_fixed_width<Element>()>* =
nullptr>
1377 build_from_non_nested(
1398 template <
typename Element = T,
1399 typename InputIterator,
1400 typename ValidityIterator,
1401 std::enable_if_t<cudf::is_fixed_width<Element>()>* =
nullptr>
1405 build_from_non_nested(
1422 template <
typename Element = T,
1423 std::enable_if_t<std::is_same_v<Element, cudf::string_view>>* =
nullptr>
1426 build_from_non_nested(
1445 template <
typename Element = T,
1446 typename ValidityIterator,
1447 std::enable_if_t<std::is_same_v<Element, cudf::string_view>>* =
nullptr>
1451 build_from_non_nested(
1479 std::vector<bool> valids;
1480 build_from_nested(elements, valids);
1524 template <
typename Val
idityIterator>
1529 std::vector<bool> validity;
1533 std::back_inserter(validity),
1535 build_from_nested(elements, validity);
1567 std::unique_ptr<cudf::column>&& offsets,
1568 std::unique_ptr<cudf::column>&& values,
1577 std::move(null_mask),
1597 void build_from_nested(std::initializer_list<lists_column_wrapper<T, SourceElementT>> elements,
1598 std::vector<bool>
const& v)
1600 auto valids = cudf::detail::make_counting_transform_iterator(
1601 0, [&v](
auto i) {
return v.empty() ?
true : v[i]; });
1604 auto const hierarchy_and_depth =
1605 std::accumulate(elements.begin(),
1607 std::pair<column_view, int32_t>{{}, -1},
1608 [](
auto acc, lists_column_wrapper
const& lcw) {
1609 return lcw.depth > acc.second ? std::pair(lcw.get_view(), lcw.depth) : acc;
1611 column_view expected_hierarchy = hierarchy_and_depth.first;
1612 int32_t
const expected_depth = hierarchy_and_depth.second;
1615 auto [cols, stubs] = preprocess_columns(elements, expected_hierarchy, expected_depth);
1619 std::vector<size_type> offsetv;
1623 std::back_inserter(offsetv),
1626 size_type ret = count;
1627 if (valid) { count += col.size(); }
1631 offsetv.push_back(count);
1636 std::vector<column_view> children;
1637 thrust::copy_if(std::cbegin(cols),
1640 std::back_inserter(children),
1641 cuda::std::identity{});
1649 depth = expected_depth + 1;
1653 return cudf::test::detail::make_null_mask(v.begin(), v.end());
1661 std::move(null_mask),
1672 void build_from_non_nested(std::unique_ptr<column> c)
1677 std::vector<size_type> offsetv;
1678 if (c->size() > 0) {
1679 offsetv.push_back(0);
1680 offsetv.push_back(c->size());
1689 size_type num_elements = offsets->size() == 0 ? 0 : offsets->size() - 1;
1732 std::unique_ptr<column> normalize_column(column_view
const& col,
1733 column_view
const& expected_hierarchy)
1736 if (col.type().id() != type_id::LIST) {
1737 CUDF_EXPECTS(col.is_empty(),
"Encountered mismatched column!");
1739 auto remainder =
empty_like(expected_hierarchy);
1743 lists_column_view lcv(col);
1746 std::make_unique<column>(lcv.offsets()),
1747 normalize_column(lists_column_view(col).child(),
1748 lists_column_view(expected_hierarchy).child()),
1755 std::pair<std::vector<column_view>, std::vector<std::unique_ptr<column>>> preprocess_columns(
1756 std::initializer_list<lists_column_wrapper<T, SourceElementT>>
const& elements,
1757 column_view& expected_hierarchy,
1760 std::vector<std::unique_ptr<column>> stubs;
1761 std::vector<column_view> cols;
1768 std::back_inserter(cols),
1769 [&](lists_column_wrapper
const& l) -> column_view {
1773 if (l.depth < expected_depth) {
1787 CUDF_EXPECTS(l.wrapped->size() == 0,
"Mismatch in column types!");
1788 stubs.push_back(empty_like(expected_hierarchy));
1790 stubs.push_back(normalize_column(l.get_view(), expected_hierarchy));
1792 return *(stubs.back());
1795 return l.get_view();
1798 return {std::move(cols), std::move(stubs)};
1801 [[nodiscard]] column_view get_view()
const
1803 return root ? lists_column_view(*wrapped).child() : *wrapped;
1843 std::vector<bool>
const& validity = {})
1845 init(std::move(child_columns), validity);
1869 std::initializer_list<std::reference_wrapper<detail::column_wrapper>> child_column_wrappers,
1870 std::vector<bool>
const& validity = {})
1872 std::vector<std::unique_ptr<cudf::column>> child_columns;
1873 child_columns.reserve(child_column_wrappers.size());
1875 child_column_wrappers.end(),
1876 std::back_inserter(child_columns),
1877 [&](
auto const& column_wrapper) {
1878 return std::make_unique<cudf::column>(column_wrapper.get(),
1879 cudf::test::get_default_stream());
1881 init(std::move(child_columns), validity);
1904 template <
typename V>
1906 std::initializer_list<std::reference_wrapper<detail::column_wrapper>> child_column_wrappers,
1909 std::vector<std::unique_ptr<cudf::column>> child_columns;
1910 child_columns.reserve(child_column_wrappers.size());
1912 child_column_wrappers.end(),
1913 std::back_inserter(child_columns),
1914 [&](
auto const& column_wrapper) {
1915 return std::make_unique<cudf::column>(column_wrapper.get(),
1916 cudf::test::get_default_stream());
1918 init(std::move(child_columns), validity_iter);
1922 void init(std::vector<std::unique_ptr<cudf::column>>&& child_columns,
1923 std::vector<bool>
const& validity)
1925 size_type num_rows = child_columns.empty() ? 0 : child_columns[0]->size();
1928 child_columns.end(),
1929 [&](
auto const& p_column) { return p_column->size() == num_rows; }),
1930 "All struct member columns must have the same row count.");
1933 "Validity buffer must have as many elements as rows in the struct column.");
1937 return cudf::test::detail::make_null_mask(validity.begin(), validity.end());
1941 std::move(child_columns),
1943 std::move(null_mask),
1947 template <
typename V>
1948 void init(std::vector<std::unique_ptr<cudf::column>>&& child_columns, V validity_iterator)
1950 size_type const num_rows = child_columns.empty() ? 0 : child_columns[0]->size();
1953 child_columns.end(),
1954 [&](
auto const& p_column) { return p_column->size() == num_rows; }),
1955 "All struct member columns must have the same row count.");
1957 std::vector<bool> validity(num_rows);
1958 std::copy(validity_iterator, validity_iterator + num_rows, validity.begin());
1960 init(std::move(child_columns), validity);
Utilities for bit and bitmask operations.
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
A container of nullable device data as a column of elements.
Indicator for the logical data type of an element in a column.
A wrapper class for operations on a dictionary column.
column_view indices() const noexcept
Returns the column of indices.
column_view keys() const noexcept
Returns the column of keys.
Given a column-view of lists type, an instance of this class provides a wrapper on this compound colu...
A non-owning, mutable view of device data as a column of elements, some of which may be null as indic...
Base class for a wrapper around a cudf::column.
std::unique_ptr< cudf::column > release()
Releases internal unique_ptr to wrapped column.
dictionary_column_wrapper(StringsIterator begin, StringsIterator end, ValidityIterator v)
Construct a nullable dictionary column of strings from the range [begin,end) using the range [v,...
dictionary_column_wrapper(std::initializer_list< std::string > strings, std::initializer_list< bool > validity)
Construct a nullable dictionary column of strings from a list of strings and a list of booleans to in...
column_view indices() const
Access indices column view.
dictionary_column_wrapper(std::initializer_list< std::string > strings)
Construct a non-nullable dictionary column of strings from a list of strings.
dictionary_column_wrapper(StringsIterator begin, StringsIterator end)
Construct a non-nullable dictionary column of strings from the range [begin,end).
dictionary_column_wrapper(std::initializer_list< std::string > strings, ValidityIterator v)
Construct a nullable dictionary column of strings from a list of strings and the range [v,...
column_view keys() const
Access keys column view.
dictionary_column_wrapper()
Default constructor initializes an empty dictionary column of strings.
column_wrapper derived class for wrapping dictionary columns.
dictionary_column_wrapper(std::initializer_list< ElementFrom > elements)
Construct a non-nullable dictionary column of fixed-width elements from an initializer list.
dictionary_column_wrapper(std::initializer_list< ElementFrom > elements, std::initializer_list< bool > validity)
Construct a nullable dictionary column from a list of fixed-width elements using another list to indi...
dictionary_column_wrapper(std::initializer_list< ElementFrom > element_list, ValidityIterator v)
Construct a nullable dictionary column from a list of fixed-width elements and the range [v,...
dictionary_column_wrapper()
Default constructor initializes an empty column with dictionary type.
dictionary_column_wrapper(InputIterator begin, InputIterator end)
Construct a non-nullable dictionary column of the fixed-width elements in the range [begin,...
dictionary_column_wrapper(InputIterator begin, InputIterator end, ValidityIterator v)
Construct a nullable dictionary column of the fixed-width elements in the range [begin,...
dictionary_column_wrapper(InputIterator begin, InputIterator end, std::initializer_list< bool > const &validity)
Construct a nullable dictionary column of the fixed-width elements in the range [begin,...
A wrapper for a column of fixed-width elements.
fixed_point_column_wrapper(FixedPointRepIterator begin, FixedPointRepIterator end, std::initializer_list< bool > const &validity, numeric::scale_type scale)
Construct a nullable column of the decimal elements in the range [begin,end) using a validity initial...
fixed_point_column_wrapper(std::initializer_list< Rep > elements, std::initializer_list< bool > validity, numeric::scale_type scale)
Construct a nullable column from an initializer list of decimal elements using another list to indica...
fixed_point_column_wrapper(FixedPointRepIterator begin, FixedPointRepIterator end, numeric::scale_type scale)
Construct a non-nullable column of the decimal elements in the range [begin,end).
fixed_point_column_wrapper(std::initializer_list< Rep > element_list, ValidityIterator v, numeric::scale_type scale)
Construct a nullable column from an initializer list of decimal elements and the range [v,...
fixed_point_column_wrapper(std::initializer_list< Rep > values, numeric::scale_type scale)
Construct a non-nullable column of decimal elements from an initializer list.
fixed_point_column_wrapper(FixedPointRepIterator begin, FixedPointRepIterator end, ValidityIterator v, numeric::scale_type scale)
Construct a nullable column of the fixed-point elements from a range.
column_wrapper derived class for wrapping columns of fixed-width elements.
fixed_width_column_wrapper(InputIterator begin, InputIterator end, std::initializer_list< bool > const &validity)
Construct a nullable column of the fixed-width elements in the range [begin,end) using a validity ini...
fixed_width_column_wrapper(std::initializer_list< std::pair< ElementFrom, bool >> elements)
Construct a nullable column from a list of pairs of fixed-width elements and validity booleans of eac...
fixed_width_column_wrapper(std::initializer_list< ElementFrom > elements, std::initializer_list< bool > validity)
Construct a nullable column from a list of fixed-width elements using another list to indicate the va...
fixed_width_column_wrapper(std::initializer_list< ElementFrom > elements)
Construct a non-nullable column of fixed-width elements from an initializer list.
fixed_width_column_wrapper(InputIterator begin, InputIterator end, ValidityIterator v)
Construct a nullable column of the fixed-width elements in the range [begin,end) using the range [v,...
fixed_width_column_wrapper(std::initializer_list< ElementFrom > element_list, ValidityIterator v)
Construct a nullable column from a list of fixed-width elements and the range [v, v + element_list....
fixed_width_column_wrapper(InputIterator begin, InputIterator end)
Construct a non-nullable column of the fixed-width elements in the range [begin,end).
fixed_width_column_wrapper()
Default constructor initializes an empty column with proper dtype.
column_wrapper derived class for wrapping columns of lists.
lists_column_wrapper(InputIterator begin, InputIterator end)
Construct a lists column containing a single list of fixed-width type from an iterator range.
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.
static lists_column_wrapper< T > make_one_empty_row_column(bool valid=true)
Construct a list column containing a single empty, optionally null row.
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 va...
lists_column_wrapper()
Construct am empty lists column.
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.
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 val...
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...
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.
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 val...
column_wrapper derived class for wrapping columns of strings.
strings_column_wrapper(std::initializer_list< std::pair< std::string, bool >> strings)
Construct a nullable column from a list of pairs of strings and validity booleans of each string.
strings_column_wrapper()
Default constructor initializes an empty column of strings.
strings_column_wrapper(std::initializer_list< std::string > strings)
Construct a non-nullable column of strings from a list of strings.
strings_column_wrapper(std::initializer_list< std::string > strings, std::initializer_list< bool > validity)
Construct a nullable column of strings from a list of strings and a list of booleans to indicate the ...
strings_column_wrapper(std::initializer_list< std::string > strings, ValidityIterator v)
Construct a nullable column of strings from a list of strings and the range [v, v + strings....
strings_column_wrapper(StringsIterator begin, StringsIterator end)
Construct a non-nullable column of strings from the range [begin,end).
strings_column_wrapper(StringsIterator begin, StringsIterator end, ValidityIterator v)
Construct a nullable column of strings from the range [begin,end) using the range [v,...
column_wrapper derived class for wrapping columns of structs.
structs_column_wrapper(std::initializer_list< std::reference_wrapper< detail::column_wrapper >> child_column_wrappers, V validity_iter)
Constructs a struct column from the list of column wrappers for child columns.
structs_column_wrapper(std::initializer_list< std::reference_wrapper< detail::column_wrapper >> child_column_wrappers, std::vector< bool > const &validity={})
Constructs a struct column from the list of column wrappers for child columns.
structs_column_wrapper(std::vector< std::unique_ptr< cudf::column >> &&child_columns, std::vector< bool > const &validity={})
Constructs a struct column from the specified list of pre-constructed child columns.
void const * data() const noexcept
Class definition for cudf::column.
Column APIs for gather, scatter, split, slice, etc.
Dictionary column encode and decode APIs.
Class definition for fixed point data type.
std::unique_ptr< column > empty_like(column_view const &input)
Initializes and returns an empty column of the same type as the input.
std::unique_ptr< column > make_strings_column(cudf::device_span< thrust::pair< char const *, size_type > const > strings, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Construct a STRING type column given a device span of pointer/size pairs.
std::unique_ptr< cudf::column > make_structs_column(size_type num_rows, std::vector< std::unique_ptr< column >> &&child_columns, size_type null_count, rmm::device_buffer &&null_mask, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Construct a STRUCT column using specified child columns as members.
std::unique_ptr< column > make_empty_column(data_type type)
Creates an empty column of the specified type.
std::unique_ptr< cudf::column > make_lists_column(size_type num_rows, std::unique_ptr< column > offsets_column, std::unique_ptr< column > child_column, size_type null_count, rmm::device_buffer &&null_mask, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Construct a LIST type column given offsets column, child column, null mask and null count.
cudf::size_type null_count(bitmask_type const *bitmask, size_type start, size_type stop, rmm::cuda_stream_view stream=cudf::get_default_stream())
Given a validity bitmask, counts the number of null elements (unset bits) in the range [start,...
std::size_t bitmask_allocation_size_bytes(size_type number_of_bits, std::size_t padding_boundary=64)
Computes the required bytes necessary to represent the specified number of bits with a given padding ...
rmm::device_buffer copy_bitmask(bitmask_type const *mask, size_type begin_bit, size_type end_bit, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Creates a device_buffer from a slice of bitmask defined by a range of indices [begin_bit,...
rmm::device_buffer create_null_mask(size_type size, mask_state state, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Creates a device_buffer for use as a null value indicator bitmask of a column
std::unique_ptr< column > concatenate(host_span< column_view const > columns_to_concat, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Concatenates multiple columns into a single column.
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
std::unique_ptr< column > encode(column_view const &column, data_type indices_type=data_type{type_id::INT32}, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Construct a dictionary column by dictionary encoding an existing column.
scale_type
The scale type for fixed_point.
rmm::device_async_resource_ref get_current_device_resource_ref()
Get the current device memory resource reference.
device_async_resource_ref get_current_device_resource_ref()
std::unique_ptr< column > is_fixed_point(strings_column_view const &input, data_type decimal_type=data_type{type_id::DECIMAL64}, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Returns a boolean column identifying strings in which all characters are valid for conversion to fixe...
CUDF_HOST_DEVICE void set_bit_unsafe(bitmask_type *bitmask, size_type bit_index)
Sets the specified bit to 1
#define CUDF_EXPECTS(...)
Macro for checking (pre-)conditions that throws an exception when a condition is violated.
int32_t size_type
Row index type for columns and tables.
uint32_t bitmask_type
Bitmask type stored as 32-bit unsigned integer.
size_type distance(T f, T l)
Similar to std::distance but returns cudf::size_type and performs static_cast
constexpr CUDF_HOST_DEVICE bool is_nested()
Indicates whether T is a nested type.
@ ALL_NULL
Null mask allocated, initialized to all elements NULL.
@ DICTIONARY32
Dictionary type using int32 indices.
Class definition for cudf::lists_column_view.
fixed_point and supporting types
APIs for managing validity bitmasks.
Convert between source and target types when they differ and where possible.
constexpr ToT operator()(FromT element) const
No conversion necessary: Same type, simply copy element to output.
Defines the mapping between cudf::type_id runtime type information and concrete C++ types.
Type declarations for libcudf.