lists_column_view.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020-2024, 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 #include <cudf/utilities/export.hpp>
21 
22 #include <rmm/cuda_stream_view.hpp>
23 
29 namespace CUDF_EXPORT cudf {
30 
40 class lists_column_view : private column_view {
41  public:
42  lists_column_view() = default;
48  lists_column_view(column_view const& lists_column);
51  ~lists_column_view() override = default;
64 
65  static constexpr size_type offsets_column_index{0};
66  static constexpr size_type child_column_index{1};
67 
68  using column_view::child_begin;
69  using column_view::child_end;
71  using column_view::is_empty;
73  using column_view::null_mask;
74  using column_view::offset;
75  using column_view::size;
76  using offset_iterator = size_type const*;
77 
83  [[nodiscard]] column_view parent() const;
84 
91  [[nodiscard]] column_view offsets() const;
92 
99  [[nodiscard]] column_view child() const;
100 
114 
120  [[nodiscard]] offset_iterator offsets_begin() const noexcept
121  {
122  return offsets().begin<size_type>() + offset();
123  }
124 
135  [[nodiscard]] offset_iterator offsets_end() const noexcept
136  {
137  return offsets_begin() + size() + 1;
138  }
139 }; // end of group
141 } // namespace CUDF_EXPORT cudf
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
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.
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.
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
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,...
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:95
cuDF interfaces
Definition: aggregation.hpp:35
bool has_nulls(table_view const &view)
Returns True if the table has nulls in any of its columns.