19 #include <cudf_test/column_utilities.hpp>
20 #include <cudf_test/default_stream.hpp>
25 #include <cudf/detail/concatenate.hpp>
26 #include <cudf/detail/iterator.cuh>
27 #include <cudf/detail/utilities/vector_factories.hpp>
35 #include <cudf/utilities/export.hpp>
42 #include <cuda/std/functional>
43 #include <thrust/copy.h>
44 #include <thrust/host_vector.h>
45 #include <thrust/iterator/constant_iterator.h>
46 #include <thrust/iterator/counting_iterator.h>
47 #include <thrust/iterator/transform_iterator.h>
54 namespace CUDF_EXPORT
cudf {
90 std::unique_ptr<cudf::column>
release() {
return std::move(wrapped); }
93 std::unique_ptr<cudf::column> wrapped{};
99 template <
typename From,
typename To>
109 template <
typename FromT = From,
111 std::enable_if_t<std::is_same_v<FromT, ToT>,
void>* =
nullptr>
126 typename FromT = From,
129 std::is_constructible_v<ToT, FromT>),
131 constexpr ToT
operator()(FromT element)
const
133 return static_cast<ToT
>(element);
145 typename FromT = From,
147 std::enable_if_t<std::is_integral_v<FromT> && cudf::is_timestamp<ToT>(),
void>* =
nullptr>
150 return ToT{
typename ToT::duration{element}};
164 template <
typename ElementTo,
165 typename ElementFrom,
166 typename InputIterator,
167 std::enable_if_t<not cudf::is_fixed_point<ElementTo>()>* =
nullptr>
170 static_assert(cudf::is_fixed_width<ElementTo>(),
"Unexpected non-fixed width type.");
171 auto transformer = fixed_width_type_converter<ElementFrom, ElementTo>{};
172 auto transform_begin = thrust::make_transform_iterator(begin, transformer);
174 auto const elements = thrust::host_vector<ElementTo>(transform_begin, transform_begin + size);
193 template <
typename ElementTo,
194 typename ElementFrom,
195 typename InputIterator,
196 std::enable_if_t<not cudf::is_fixed_point<ElementFrom>() and
198 rmm::device_buffer make_elements(InputIterator begin, InputIterator end)
200 using RepType =
typename ElementTo::rep;
201 auto transformer = fixed_width_type_converter<ElementFrom, RepType>{};
202 auto transform_begin = thrust::make_transform_iterator(begin, transformer);
204 auto const elements = thrust::host_vector<RepType>(transform_begin, transform_begin + size);
219 template <
typename ElementTo,
220 typename ElementFrom,
221 typename InputIterator,
222 std::enable_if_t<cudf::is_fixed_point<ElementFrom>() and
224 rmm::device_buffer make_elements(InputIterator begin, InputIterator end)
227 using RepType =
typename ElementTo::rep;
229 CUDF_EXPECTS(std::all_of(begin, end, [](ElementFrom v) {
return v.scale() == 0; }),
230 "Only zero-scale fixed-point values are supported");
232 auto to_rep = [](ElementTo fp) {
return fp.value(); };
233 auto transformer_begin = thrust::make_transform_iterator(begin, to_rep);
235 auto const elements = thrust::host_vector<RepType>(transformer_begin, transformer_begin + size);
254 template <
typename Val
idityIterator>
255 std::pair<std::vector<bitmask_type>,
cudf::size_type> make_null_mask_vector(ValidityIterator begin,
256 ValidityIterator end)
261 auto null_mask = std::vector<bitmask_type>(num_words, 0);
263 for (
auto i = 0; i < size; ++i) {
287 template <
typename Val
idityIterator>
288 std::pair<rmm::device_buffer, cudf::size_type> make_null_mask(ValidityIterator begin,
289 ValidityIterator end)
291 auto [null_mask,
null_count] = make_null_mask_vector(begin, end);
312 template <
typename StringsIterator,
typename Val
idityIterator>
313 auto make_chars_and_offsets(StringsIterator begin, StringsIterator end, ValidityIterator v)
315 std::vector<char> chars{};
316 std::vector<cudf::size_type> offsets(1, 0);
317 for (
auto str = begin; str < end; ++str) {
318 std::string tmp = (*v++) ? std::string(*str) : std::string{};
319 chars.insert(chars.end(), std::cbegin(tmp), std::cend(tmp));
320 auto const last_offset =
static_cast<std::size_t
>(offsets.back());
321 auto const next_offset = last_offset + tmp.length();
323 next_offset <
static_cast<std::size_t
>(std::numeric_limits<cudf::size_type>::max()),
324 "Cannot use strings_column_wrapper to build a large strings column");
327 return std::pair(std::move(chars), std::move(offsets));
339 template <
typename ElementTo,
typename SourceElementT = ElementTo>
347 std::vector<ElementTo> empty;
351 detail::make_elements<ElementTo, SourceElementT>(empty.begin(), empty.end()),
374 template <
typename InputIterator>
380 detail::make_elements<ElementTo, SourceElementT>(begin, end),
408 template <
typename InputIterator,
typename Val
idityIterator>
413 auto [null_mask,
null_count] = detail::make_null_mask(v, v + size);
416 detail::make_elements<ElementTo, SourceElementT>(begin, end),
417 std::move(null_mask),
433 template <
typename ElementFrom>
456 template <
typename ElementFrom>
458 std::initializer_list<bool> validity)
480 template <
typename Val
idityIterator,
typename ElementFrom>
504 template <
typename InputIterator>
507 std::initializer_list<bool>
const& validity)
529 template <
typename ElementFrom>
533 thrust::make_transform_iterator(elements.begin(), [](
auto const& e) { return e.first; });
534 auto end = begin + elements.size();
536 thrust::make_transform_iterator(elements.begin(), [](
auto const& e) { return e.second; });
546 template <
typename Rep>
565 template <
typename FixedPo
intRepIterator>
567 FixedPointRepIterator end,
571 CUDF_EXPECTS(numeric::is_supported_representation_type<Rep>(),
"not valid representation type");
574 auto const elements = thrust::host_vector<Rep>(begin, end);
575 auto const id = type_to_id<numeric::fixed_point<Rep, numeric::Radix::BASE_10>>();
630 template <
typename FixedPo
intRepIterator,
typename Val
idityIterator>
632 FixedPointRepIterator end,
637 CUDF_EXPECTS(numeric::is_supported_representation_type<Rep>(),
"not valid representation type");
640 auto const elements = thrust::host_vector<Rep>(begin, end);
641 auto const id = type_to_id<numeric::fixed_point<Rep, numeric::Radix::BASE_10>>();
643 auto [null_mask,
null_count] = detail::make_null_mask(v, v + size);
648 std::move(null_mask),
670 std::initializer_list<bool> validity,
673 std::cbegin(elements), std::cend(elements), std::cbegin(validity), scale)
695 template <
typename Val
idityIterator>
723 template <
typename FixedPo
intRepIterator>
725 FixedPointRepIterator end,
726 std::initializer_list<bool>
const& validity,
763 template <
typename StringsIterator>
767 if (num_strings == 0) {
771 auto all_valid = thrust::make_constant_iterator(
true);
772 auto [chars, offsets] = detail::make_chars_and_offsets(begin, end, all_valid);
773 auto d_chars = cudf::detail::make_device_uvector_async(
775 auto d_offsets = std::make_unique<cudf::column>(
776 cudf::detail::make_device_uvector_sync(
812 template <
typename StringsIterator,
typename Val
idityIterator>
817 if (num_strings == 0) {
821 auto [chars, offsets] = detail::make_chars_and_offsets(begin, end, v);
822 auto [null_mask,
null_count] = detail::make_null_mask_vector(v, v + num_strings);
823 auto d_chars = cudf::detail::make_device_uvector_async(
825 auto d_offsets = std::make_unique<cudf::column>(
826 cudf::detail::make_device_uvector_async(
830 auto d_bitmask = cudf::detail::make_device_uvector_sync(
833 num_strings, std::move(d_offsets), d_chars.release(),
null_count, d_bitmask.release());
871 template <
typename Val
idityIterator>
893 std::initializer_list<bool> validity)
921 thrust::make_transform_iterator(strings.begin(), [](
auto const& s) { return s.first; });
922 auto end = begin + strings.size();
924 thrust::make_transform_iterator(strings.begin(), [](
auto const& s) { return s.second; });
937 template <
typename KeyElementTo,
typename SourceElementT = KeyElementTo>
972 template <
typename InputIterator>
1006 template <
typename InputIterator,
typename Val
idityIterator>
1029 template <
typename ElementFrom>
1053 template <
typename ElementFrom>
1055 std::initializer_list<bool> validity)
1078 template <
typename Val
idityIterator,
typename ElementFrom>
1104 template <
typename InputIterator>
1107 std::initializer_list<bool>
const& validity)
1172 template <
typename StringsIterator>
1208 template <
typename StringsIterator,
typename Val
idityIterator>
1252 template <
typename Val
idityIterator>
1274 std::initializer_list<bool> validity)
1315 template <
typename T,
typename SourceElementT = T>
1336 template <typename Element = T, std::enable_if_t<cudf::is_fixed_width<Element>()>* =
nullptr>
1339 build_from_non_nested(
1358 template <
typename Element = T,
1359 typename InputIterator,
1360 std::enable_if_t<cudf::is_fixed_width<Element>()>* =
nullptr>
1363 build_from_non_nested(
1382 template <
typename Element = T,
1383 typename ValidityIterator,
1384 std::enable_if_t<cudf::is_fixed_width<Element>()>* =
nullptr>
1388 build_from_non_nested(
1409 template <
typename Element = T,
1410 typename InputIterator,
1411 typename ValidityIterator,
1412 std::enable_if_t<cudf::is_fixed_width<Element>()>* =
nullptr>
1416 build_from_non_nested(
1433 template <
typename Element = T,
1434 std::enable_if_t<std::is_same_v<Element, cudf::string_view>>* =
nullptr>
1437 build_from_non_nested(
1456 template <
typename Element = T,
1457 typename ValidityIterator,
1458 std::enable_if_t<std::is_same_v<Element, cudf::string_view>>* =
nullptr>
1462 build_from_non_nested(
1490 std::vector<bool> valids;
1491 build_from_nested(elements, valids);
1535 template <
typename Val
idityIterator>
1540 std::vector<bool> validity;
1544 std::back_inserter(validity),
1546 build_from_nested(elements, validity);
1578 std::unique_ptr<cudf::column>&& offsets,
1579 std::unique_ptr<cudf::column>&& values,
1588 std::move(null_mask),
1608 void build_from_nested(std::initializer_list<lists_column_wrapper<T, SourceElementT>> elements,
1609 std::vector<bool>
const& v)
1611 auto valids = cudf::detail::make_counting_transform_iterator(
1612 0, [&v](
auto i) {
return v.empty() ?
true : v[i]; });
1615 auto const hierarchy_and_depth =
1616 std::accumulate(elements.begin(),
1618 std::pair<column_view, int32_t>{{}, -1},
1619 [](
auto acc, lists_column_wrapper
const& lcw) {
1620 return lcw.depth > acc.second ? std::pair(lcw.get_view(), lcw.depth) : acc;
1622 column_view expected_hierarchy = hierarchy_and_depth.first;
1623 int32_t
const expected_depth = hierarchy_and_depth.second;
1626 auto [cols, stubs] = preprocess_columns(elements, expected_hierarchy, expected_depth);
1630 std::vector<size_type> offsetv;
1634 std::back_inserter(offsetv),
1637 size_type ret = count;
1638 if (valid) { count += col.size(); }
1642 offsetv.push_back(count);
1647 std::vector<column_view> children;
1648 thrust::copy_if(std::cbegin(cols),
1651 std::back_inserter(children),
1652 cuda::std::identity{});
1660 depth = expected_depth + 1;
1664 return cudf::test::detail::make_null_mask(v.begin(), v.end());
1672 std::move(null_mask),
1683 void build_from_non_nested(std::unique_ptr<column> c)
1688 std::vector<size_type> offsetv;
1689 if (c->size() > 0) {
1690 offsetv.push_back(0);
1691 offsetv.push_back(c->size());
1700 size_type num_elements = offsets->size() == 0 ? 0 : offsets->size() - 1;
1743 std::unique_ptr<column> normalize_column(column_view
const& col,
1744 column_view
const& expected_hierarchy)
1747 if (col.type().id() != type_id::LIST) {
1748 CUDF_EXPECTS(col.is_empty(),
"Encountered mismatched column!");
1750 auto remainder =
empty_like(expected_hierarchy);
1754 lists_column_view lcv(col);
1757 std::make_unique<column>(lcv.offsets()),
1758 normalize_column(lists_column_view(col).child(),
1759 lists_column_view(expected_hierarchy).child()),
1766 std::pair<std::vector<column_view>, std::vector<std::unique_ptr<column>>> preprocess_columns(
1767 std::initializer_list<lists_column_wrapper<T, SourceElementT>>
const& elements,
1768 column_view& expected_hierarchy,
1771 std::vector<std::unique_ptr<column>> stubs;
1772 std::vector<column_view> cols;
1779 std::back_inserter(cols),
1780 [&](lists_column_wrapper
const& l) -> column_view {
1784 if (l.depth < expected_depth) {
1798 CUDF_EXPECTS(l.wrapped->size() == 0,
"Mismatch in column types!");
1799 stubs.push_back(empty_like(expected_hierarchy));
1801 stubs.push_back(normalize_column(l.get_view(), expected_hierarchy));
1803 return *(stubs.back());
1806 return l.get_view();
1809 return {std::move(cols), std::move(stubs)};
1812 [[nodiscard]] column_view get_view()
const
1814 return root ? lists_column_view(*wrapped).child() : *wrapped;
1854 std::vector<bool>
const& validity = {})
1856 init(std::move(child_columns), validity);
1880 std::initializer_list<std::reference_wrapper<detail::column_wrapper>> child_column_wrappers,
1881 std::vector<bool>
const& validity = {})
1883 std::vector<std::unique_ptr<cudf::column>> child_columns;
1884 child_columns.reserve(child_column_wrappers.size());
1886 child_column_wrappers.end(),
1887 std::back_inserter(child_columns),
1888 [&](
auto const& column_wrapper) {
1889 return std::make_unique<cudf::column>(column_wrapper.get(),
1890 cudf::test::get_default_stream());
1892 init(std::move(child_columns), validity);
1915 template <
typename V>
1917 std::initializer_list<std::reference_wrapper<detail::column_wrapper>> child_column_wrappers,
1920 std::vector<std::unique_ptr<cudf::column>> child_columns;
1921 child_columns.reserve(child_column_wrappers.size());
1923 child_column_wrappers.end(),
1924 std::back_inserter(child_columns),
1925 [&](
auto const& column_wrapper) {
1926 return std::make_unique<cudf::column>(column_wrapper.get(),
1927 cudf::test::get_default_stream());
1929 init(std::move(child_columns), validity_iter);
1933 void init(std::vector<std::unique_ptr<cudf::column>>&& child_columns,
1934 std::vector<bool>
const& validity)
1936 size_type num_rows = child_columns.empty() ? 0 : child_columns[0]->size();
1939 child_columns.end(),
1940 [&](
auto const& p_column) { return p_column->size() == num_rows; }),
1941 "All struct member columns must have the same row count.");
1944 "Validity buffer must have as many elements as rows in the struct column.");
1948 return cudf::test::detail::make_null_mask(validity.begin(), validity.end());
1952 std::move(child_columns),
1954 std::move(null_mask),
1958 template <
typename V>
1959 void init(std::vector<std::unique_ptr<cudf::column>>&& child_columns, V validity_iterator)
1961 size_type const num_rows = child_columns.empty() ? 0 : child_columns[0]->size();
1964 child_columns.end(),
1965 [&](
auto const& p_column) { return p_column->size() == num_rows; }),
1966 "All struct member columns must have the same row count.");
1968 std::vector<bool> validity(num_rows);
1969 std::copy(validity_iterator, validity_iterator + num_rows, validity.begin());
1971 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派生类,用于包装固定宽度元素的列。
fixed_width_column_wrapper(InputIterator begin, InputIterator end, std::initializer_list< bool > const &validity)
使用有效性初始列表构造范围 [begin,end) 中固定宽度元素的nullable列。
fixed_width_column_wrapper(std::initializer_list< std::pair< ElementFrom, bool >> elements)
从固定宽度元素及其有效性布尔值对的列表构造nullable列。
fixed_width_column_wrapper(std::initializer_list< ElementFrom > elements, std::initializer_list< bool > validity)
使用另一个列表来指示有效性,从固定宽度元素的列表构造nullable列。
fixed_width_column_wrapper(std::initializer_list< ElementFrom > elements)
从初始化列表构造非nullable的固定宽度元素列。
fixed_width_column_wrapper(InputIterator begin, InputIterator end, ValidityIterator v)
使用范围 [v,...) 构造范围 [begin,end) 中固定宽度元素的nullable列。
fixed_width_column_wrapper(std::initializer_list< ElementFrom > element_list, ValidityIterator v)
从固定宽度元素的列表和范围 [v, v + element_list.size()) 构造nullable列。
fixed_width_column_wrapper(InputIterator begin, InputIterator end)
构造范围 [begin,end) 中固定宽度元素的非nullable列。
fixed_width_column_wrapper()
默认构造函数初始化具有正确dtype的空列。
column_wrapper派生类,用于包装列表列。
lists_column_wrapper(InputIterator begin, InputIterator end)
从迭代器范围构造包含单个固定宽度类型列表的列表列。
lists_column_wrapper(std::initializer_list< lists_column_wrapper< T, SourceElementT >> elements, ValidityIterator v)
从值初始化列表和有效性迭代器构造嵌套列表的列表列。
static lists_column_wrapper< T > make_one_empty_row_column(bool valid=true)
构造一个包含单个空行(可选项为null)的列表列。
lists_column_wrapper(InputIterator begin, InputIterator end, ValidityIterator v)
从迭代器范围和有效性迭代器构造包含单个固定宽度类型列表的列表列。
lists_column_wrapper()
构造一个空的列表列。
lists_column_wrapper(std::initializer_list< lists_column_wrapper< T, SourceElementT >> elements)
从值初始化列表构造嵌套列表的列表列。
lists_column_wrapper(std::initializer_list< SourceElementT > elements)
从值初始化列表构造包含单个固定宽度类型列表的列表列。
lists_column_wrapper(std::initializer_list< std::string > elements, ValidityIterator v)
从值初始化列表和有效性迭代器构造包含单个字符串列表的列表列。
lists_column_wrapper(std::initializer_list< std::string > elements)
从值初始化列表构造包含单个字符串列表的列表列。
lists_column_wrapper(std::initializer_list< SourceElementT > elements, ValidityIterator v)
从值初始化列表构造包含单个固定宽度类型列表的列表列。
column_wrapper派生类,用于包装字符串列。
strings_column_wrapper(std::initializer_list< std::pair< std::string, bool >> strings)
从字符串及其有效性布尔值对的列表构造nullable列。
strings_column_wrapper()
默认构造函数初始化空的字符串列。
strings_column_wrapper(std::initializer_list< std::string > strings)
从字符串列表构造非nullable的字符串列。
strings_column_wrapper(std::initializer_list< std::string > strings, std::initializer_list< bool > validity)
使用布尔值列表来指示有效性,从字符串列表构造nullable字符串列。
strings_column_wrapper(std::initializer_list< std::string > strings, ValidityIterator v)
使用范围 [v, v + strings.size()) 构造nullable字符串列。
strings_column_wrapper(StringsIterator begin, StringsIterator end)
构造范围 [begin,end) 中的非nullable字符串列。
strings_column_wrapper(StringsIterator begin, StringsIterator end, ValidityIterator v)
使用范围 [v,...) 构造范围 [begin,end) 中的nullable字符串列。
column_wrapper派生类,用于包装结构体列。
structs_column_wrapper(std::initializer_list< std::reference_wrapper< detail::column_wrapper >> child_column_wrappers, V validity_iter)
从子列的列包装器列表构造结构体列。
structs_column_wrapper(std::initializer_list< std::reference_wrapper< detail::column_wrapper >> child_column_wrappers, std::vector< bool > const &validity={})
从子列的列包装器列表构造结构体列。
structs_column_wrapper(std::vector< std::unique_ptr< cudf::column >> &&child_columns, std::vector< bool > const &validity={})
从指定的预构造子列列表构造结构体列。
void const * data() const noexcept
std::unique_ptr< column > empty_like(column_view const &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())
给定一个设备span的指针/大小对,构造一个STRING类型列。
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())
使用指定的子列作为成员构建 STRUCT 列。
std::unique_ptr< column > make_empty_column(data_type 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())
给定偏移量列、子列、空值掩码和空值计数,构建 LIST 类型列。
cudf::size_type null_count(bitmask_type const *bitmask, size_type start, size_type stop, rmm::cuda_stream_view stream=cudf::get_default_stream())
给定有效位掩码,计算范围 [start,...] 中的空元素(未设置的位)数量。
std::size_t bitmask_allocation_size_bytes(size_type number_of_bits, std::size_t padding_boundary=64)
计算表示指定数量的位并使用给定填充所需的字节数...
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())
从由索引范围 [begin_bit,...] 定义的位掩码切片创建 device_buffer。
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())
创建 device_buffer 以用作列的空值指示位掩码。
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())
将多个列连接成单个列。
rmm::cuda_stream_view const get_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())
通过对现有列进行字典编码来构建字典列。
scale_type
fixed_point 的刻度类型。
rmm::device_async_resource_ref get_current_device_resource_ref()
获取当前设备内存资源引用。
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())
返回一个布尔列,用于标识所有字符都有效,可转换为 fixed point 的字符串...
CUDF_HOST_DEVICE void set_bit_unsafe(bitmask_type *bitmask, size_type bit_index)
将指定的位设置为 1。
#define CUDF_EXPECTS(...)
用于检查(前置)条件的宏,当条件不满足时抛出异常。
int32_t size_type
列和表的行索引类型。
uint32_t bitmask_type
存储为 32 位无符号整数的位掩码类型。
size_type distance(T f, T l)
类似于 std::distance,但返回 cudf::size_type 并执行 static_cast。
constexpr CUDF_HOST_DEVICE bool is_nested()
指示 T 是否为嵌套类型。
@ ALL_NULL
已分配空值掩码,初始化为所有元素 NULL。
@ DICTIONARY32
使用 int32 索引的字典类型。
cudf::lists_column_view 的类定义。
constexpr ToT operator()(FromT element) const
无需转换:类型相同,只需将元素复制到输出。
定义 cudf::type_id 运行时类型信息与具体 C++ 类型之间的映射。