lists_column_view.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020-2023, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include <cudf/column/column.hpp>
20 
21 #include <rmm/cuda_stream_view.hpp>
22 
28 namespace cudf {
29 
39 class lists_column_view : private column_view {
40  public:
46  lists_column_view(column_view const& lists_column);
49  ~lists_column_view() = default;
62 
63  static constexpr size_type offsets_column_index{0};
64  static constexpr size_type child_column_index{1};
65 
72  using column_view::offset;
73  using column_view::size;
74  using offset_iterator = size_type const*;
75 
81  [[nodiscard]] column_view parent() const;
82 
89  [[nodiscard]] column_view offsets() const;
90 
97  [[nodiscard]] column_view child() const;
98 
111  [[nodiscard]] column_view get_sliced_child(rmm::cuda_stream_view stream) const;
112 
118  [[nodiscard]] offset_iterator offsets_begin() const noexcept
119  {
120  return offsets().begin<size_type>() + offset();
121  }
122 
133  [[nodiscard]] offset_iterator offsets_end() const noexcept
134  {
135  return offsets_begin() + size() + 1;
136  }
137 }; // end of group
139 } // namespace cudf
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
auto child_begin() const noexcept
Returns iterator to the beginning of the ordered sequence of child column-views.
auto child_end() const noexcept
Returns iterator to the end of the ordered sequence of child column-views.
size_type null_count() const
Returns the count of null elements.
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.
size_type offset() const noexcept
Returns the index of the first element relative to the base memory allocation, i.e....
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 is_empty() const noexcept
Returns true if size() returns zero, or false otherwise.
Given a column-view of lists type, an instance of this class provides a wrapper on this compound colu...
column_view offsets() const
Returns the internal column of offsets.
lists_column_view & operator=(lists_column_view const &)=default
Copy assignment operator.
static constexpr size_type child_column_index
The index of the child column.
lists_column_view & operator=(lists_column_view &&)=default
Move assignment operator.
offset_iterator offsets_begin() const noexcept
Return first offset (accounting for column offset)
column_view get_sliced_child(rmm::cuda_stream_view stream) const
Returns the internal child column, applying any offset from the root.
lists_column_view(lists_column_view const &)=default
Copy constructor.
static constexpr size_type offsets_column_index
The index of the offsets column.
lists_column_view(column_view const &lists_column)
Construct a new lists column view object from a column view.
size_type const * offset_iterator
Iterator type for offsets.
column_view child() const
Returns the internal child column.
lists_column_view(lists_column_view &&)=default
Move constructor.
offset_iterator offsets_end() const noexcept
Return pointer to the position that is one past the last offset.
column_view parent() const
Returns the parent column.
Class definition for cudf::column.
column view class definitions
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:93
cuDF interfaces
Definition: aggregation.hpp:34