21 #include <cudf/utilities/prefetch.hpp>
27 #include <type_traits>
34 namespace CUDF_EXPORT
cudf {
72 template <
typename T = void,
73 CUDF_ENABLE_IF(std::is_same_v<T, void> or is_rep_layout_compatible<T>())>
74 T
const*
head() const noexcept
76 return static_cast<T const*
>(get_data());
91 template <typename T, CUDF_ENABLE_IF(is_rep_layout_compatible<T>())>
92 T
const*
data()
const noexcept
94 return head<T>() + _offset;
107 template <typename T, CUDF_ENABLE_IF(is_rep_layout_compatible<T>())>
123 template <typename T, CUDF_ENABLE_IF(is_rep_layout_compatible<T>())>
124 T
const*
end()
const noexcept
126 return begin<T>() + size();
141 [[nodiscard]]
bool is_empty() const noexcept {
return size() == 0; }
159 [[nodiscard]]
bool nullable() const noexcept {
return nullptr != _null_mask; }
238 virtual void const*
get_data() const noexcept {
return _data; }
332 #pragma nv_exec_check_disable
336 #pragma nv_exec_check_disable
385 std::vector<column_view>
const& children = {});
395 return _children[child_index];
417 auto child_end() const noexcept {
return _children.cend(); }
427 template <typename T, CUDF_ENABLE_IF(cudf::is_numeric<T>() or
cudf::
is_chrono<T>())>
430 cudf::
data_type{cudf::type_to_id<T>()}, data.size(), data.data(),
nullptr, 0, 0, {})
433 data.size() <=
static_cast<std::size_t
>(std::numeric_limits<cudf::size_type>::max()),
434 "Data exceeds the column size limit",
435 std::overflow_error);
449 template <typename T, CUDF_ENABLE_IF(cudf::is_numeric<T>() or
cudf::
is_chrono<T>())>
453 "Device span type must match column view type.");
552 std::vector<mutable_column_view>
const& children = {});
569 template <
typename T = void,
570 CUDF_ENABLE_IF(std::is_same_v<T, void> or is_rep_layout_compatible<T>())>
573 return const_cast<T*
>(detail::column_view_base::head<T>());
588 template <typename T, CUDF_ENABLE_IF(is_rep_layout_compatible<T>())>
591 return const_cast<T*
>(detail::column_view_base::data<T>());
604 template <typename T, CUDF_ENABLE_IF(is_rep_layout_compatible<T>())>
607 return const_cast<T*
>(detail::column_view_base::begin<T>());
620 template <typename T, CUDF_ENABLE_IF(is_rep_layout_compatible<T>())>
623 return const_cast<T*
>(detail::column_view_base::end<T>());
637 return const_cast<bitmask_type*
>(detail::column_view_base::null_mask());
657 return mutable_children[child_index];
672 auto child_begin() const noexcept {
return mutable_children.begin(); }
679 auto child_end() const noexcept {
return mutable_children.end(); }
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
column_view(column_view &&)=default
Move constructor.
size_type num_children() const noexcept
Returns the number of child columns.
auto child_begin() const noexcept
Returns iterator to the beginning of the ordered sequence of child column-views.
column_view & operator=(column_view &&)=default
Move assignment operator.
column_view & operator=(column_view const &)=default
Copy assignment operator.
void const * get_data() const noexcept override
Returns pointer to the base device memory allocation.
auto child_end() const noexcept
Returns iterator to the end of the ordered sequence of child column-views.
column_view child(size_type child_index) const noexcept
Returns the specified child.
column_view(data_type type, size_type size, void const *data, bitmask_type const *null_mask, size_type null_count, size_type offset=0, std::vector< column_view > const &children={})
Construct a column_view from pointers to device memory for the elements and bitmask of the column.
column_view(column_view const &)=default
Copy constructor.
Indicator for the logical data type of an element in a column.
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
size_type null_count(size_type begin, size_type end) const
Returns the count of null elements in the range [begin, end)
T const * end() const noexcept
Return one past the last element after underlying data is casted to the specified type.
data_type type() const noexcept
Returns the element data_type
column_view_base(column_view_base &&)=default
Move constructor.
column_view_base(data_type type, size_type size, void const *data, bitmask_type const *null_mask, size_type null_count, size_type offset=0)
Construct a column_view_base from pointers to device memory for the elements and bitmask of the colum...
size_type null_count() const
Returns the count of null elements.
column_view_base & operator=(column_view_base const &)=default
Copy assignment operator.
column_view_base & operator=(column_view_base &&)=default
Move assignment operator.
size_type size() const noexcept
Returns the number of elements in the column.
T const * begin() const noexcept
Return first element (accounting for offset) after underlying data is casted to the specified type.
T const * data() const noexcept
Returns the underlying data casted to the specified type, plus the offset.
size_type offset() const noexcept
Returns the index of the first element relative to the base memory allocation, i.e....
virtual void const * get_data() const noexcept
Returns pointer to the base device memory allocation.
T const * head() const noexcept
Returns pointer to the base device memory allocation casted to the specified type.
bool has_nulls(size_type begin, size_type end) const
Indicates if the column contains null elements in the range [begin, end), i.e., null_count(begin,...
bool has_nulls() const
Indicates if the column contains null elements, i.e., null_count() > 0
bitmask_type const * null_mask() const noexcept
Returns raw pointer to the underlying bitmask allocation.
bool nullable() const noexcept
Indicates if the column can contain null elements, i.e., if it has an allocated bitmask.
column_view_base(column_view_base const &)=default
Copy constructor.
bool is_empty() const noexcept
Returns true if size() returns zero, or false otherwise.
A non-owning, mutable view of device data as a column of elements, some of which may be null as indic...
T * head() const noexcept
Returns pointer to the base device memory allocation casted to the specified type.
size_type num_children() const noexcept
Returns the number of child columns.
T * begin() const noexcept
Return first element (accounting for offset) after underlying data is casted to the specified type.
void set_null_count(size_type new_null_count)
Set the null count.
auto child_begin() const noexcept
Returns iterator to the beginning of the ordered sequence of child column-views.
mutable_column_view(data_type type, size_type size, void *data, bitmask_type *null_mask, size_type null_count, size_type offset=0, std::vector< mutable_column_view > const &children={})
Construct a mutable_column_view from pointers to device memory for the elements and bitmask of the co...
T * data() const noexcept
Returns the underlying data casted to the specified type, plus the offset.
mutable_column_view(mutable_column_view const &)=default
Copy constructor.
mutable_column_view & operator=(mutable_column_view &&)=default
Move assignment operator.
mutable_column_view & operator=(mutable_column_view const &)=default
Copy assignment operator.
auto child_end() const noexcept
Returns iterator to the end of the ordered sequence of child column-views.
bitmask_type * null_mask() const noexcept
Returns raw pointer to the underlying bitmask allocation.
void const * get_data() const noexcept override
Returns pointer to the base device memory allocation.
mutable_column_view child(size_type child_index) const noexcept
Returns a reference to the specified child.
mutable_column_view(mutable_column_view &&)=default
Move constructor.
T * end() const noexcept
Return one past the last element after underlying data is casted to the specified type.
std::size_t shallow_hash(column_view const &input)
Computes a hash value from the shallow state of the specified column.
bool is_shallow_equivalent(column_view const &lhs, column_view const &rhs)
Uses only shallow state to determine if two column_views view equivalent columns.
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,...
#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.
constexpr bool is_chrono()
Indicates whether the type T is a chrono type.
#define CUDF_ENABLE_IF(...)
Convenience macro for SFINAE as an unnamed template parameter.
bool nullable(table_view const &view)
Returns True if any of the columns in the table is nullable. (not entire hierarchy)
mutable_column_view bit_cast(mutable_column_view const &input, data_type type)
Zero-copy cast between types with the same size and compatible underlying representations.
size_type count_descendants(column_view parent)
Counts the number of descendants of the specified parent.
Device version of C++20 std::span with reduced feature set.
Defines the mapping between cudf::type_id runtime type information and concrete C++ types.
Type declarations for libcudf.