scalar.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2022, 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>
19 #include <cudf/table/table.hpp>
20 #include <cudf/types.hpp>
22 
23 #include <rmm/cuda_stream_view.hpp>
24 #include <rmm/device_buffer.hpp>
25 #include <rmm/device_scalar.hpp>
26 
32 namespace cudf {
46 class scalar {
47  public:
48  virtual ~scalar() = default;
49  scalar& operator=(scalar const& other) = delete;
50  scalar& operator=(scalar&& other) = delete;
51 
57  [[nodiscard]] data_type type() const noexcept;
58 
65  void set_valid_async(bool is_valid, rmm::cuda_stream_view stream = rmm::cuda_stream_default);
66 
77  [[nodiscard]] bool is_valid(rmm::cuda_stream_view stream = rmm::cuda_stream_default) const;
78 
84  bool* validity_data();
85 
91  [[nodiscard]] bool const* validity_data() const;
92 
93  protected:
94  data_type _type{type_id::EMPTY};
96 
97  scalar() = delete;
98 
103  scalar(scalar&& other) = default;
104 
112  scalar(scalar const& other,
113  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
114  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
115 
128  bool is_valid = false,
129  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
130  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
131 };
132 
133 namespace detail {
139 template <typename T>
140 class fixed_width_scalar : public scalar {
141  static_assert(is_fixed_width<T>(), "Unexpected non-fixed-width type.");
142 
143  public:
144  using value_type = T;
145 
146  ~fixed_width_scalar() override = default;
147 
153 
154  fixed_width_scalar& operator=(fixed_width_scalar const& other) = delete;
155  fixed_width_scalar& operator=(fixed_width_scalar&& other) = delete;
156 
165  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
166  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
167 
174  void set_value(T value, rmm::cuda_stream_view stream = rmm::cuda_stream_default);
175 
179  explicit operator value_type() const;
180 
187  T value(rmm::cuda_stream_view stream = rmm::cuda_stream_default) const;
188 
193  T* data();
194 
199  T const* data() const;
200 
201  protected:
203 
204  fixed_width_scalar() = delete;
205 
215  bool is_valid = true,
216  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
217  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
218 
228  bool is_valid = true,
229  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
230  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
231 };
232 
233 } // namespace detail
234 
240 template <typename T>
242  static_assert(is_numeric<T>(), "Unexpected non-numeric type.");
243 
244  public:
245  numeric_scalar() = delete;
246  ~numeric_scalar() = default;
247 
252  numeric_scalar(numeric_scalar&& other) = default;
253 
254  numeric_scalar& operator=(numeric_scalar const& other) = delete;
255  numeric_scalar& operator=(numeric_scalar&& other) = delete;
256 
265  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
266  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
267 
277  bool is_valid = true,
278  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
279  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
280 
290  bool is_valid = true,
291  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
292  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
293 };
294 
300 template <typename T>
301 class fixed_point_scalar : public scalar {
302  static_assert(is_fixed_point<T>(), "Unexpected non-fixed_point type.");
303 
304  public:
305  using rep_type = typename T::rep;
306  using value_type = T;
307 
308  fixed_point_scalar() = delete;
309  ~fixed_point_scalar() override = default;
310 
316 
317  fixed_point_scalar& operator=(fixed_point_scalar const& other) = delete;
318  fixed_point_scalar& operator=(fixed_point_scalar&& other) = delete;
319 
328  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
329  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
330 
341  numeric::scale_type scale,
342  bool is_valid = true,
343  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
344  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
345 
355  bool is_valid = true,
356  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
357  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
358 
368  bool is_valid = true,
369  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
370  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
371 
382  numeric::scale_type scale,
383  bool is_valid = true,
384  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
385  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
386 
393  rep_type value(rmm::cuda_stream_view stream = rmm::cuda_stream_default) const;
394 
401  T fixed_point_value(rmm::cuda_stream_view stream = rmm::cuda_stream_default) const;
402 
406  explicit operator value_type() const;
407 
413 
418  rep_type const* data() const;
419 
420  protected:
422 };
423 
427 class string_scalar : public scalar {
428  public:
430 
431  string_scalar() = delete;
432  ~string_scalar() override = default;
433 
438  string_scalar(string_scalar&& other) = default;
439 
440  // string_scalar(string_scalar const& other) = delete;
441  string_scalar& operator=(string_scalar const& other) = delete;
442  string_scalar& operator=(string_scalar&& other) = delete;
443 
452  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
453  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
454 
463  string_scalar(std::string const& string,
464  bool is_valid = true,
465  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
466  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
467 
478  string_scalar(value_type const& source,
479  bool is_valid = true,
480  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
481  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
482 
494  bool is_valid = true,
495  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
496  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
497 
510  bool is_valid = true,
511  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
512  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
513 
517  explicit operator std::string() const;
518 
525  [[nodiscard]] std::string to_string(
526  rmm::cuda_stream_view stream = rmm::cuda_stream_default) const;
527 
534  [[nodiscard]] value_type value(rmm::cuda_stream_view stream = rmm::cuda_stream_default) const;
535 
540  [[nodiscard]] size_type size() const;
541 
546  [[nodiscard]] const char* data() const;
547 
548  protected:
550 };
551 
558 template <typename T>
560  static_assert(is_chrono<T>(), "Unexpected non-chrono type");
561 
562  public:
563  chrono_scalar() = delete;
564  ~chrono_scalar() = default;
565 
570  chrono_scalar(chrono_scalar&& other) = default;
571 
572  chrono_scalar& operator=(chrono_scalar const& other) = delete;
573  chrono_scalar& operator=(chrono_scalar&& other) = delete;
574 
583  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
584  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
585 
595  bool is_valid = true,
596  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
597  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
598 
608  bool is_valid = true,
609  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
610  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
611 };
612 
619 template <typename T>
620 class timestamp_scalar : public chrono_scalar<T> {
621  public:
622  static_assert(is_timestamp<T>(), "Unexpected non-timestamp type");
624  using rep_type = typename T::rep;
625 
626  timestamp_scalar() = delete;
627 
632  timestamp_scalar(timestamp_scalar&& other) = default;
633 
642  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
643  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
644 
655  template <typename Duration2>
656  timestamp_scalar(Duration2 const& value,
657  bool is_valid,
658  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
659  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
660 
666 };
667 
674 template <typename T>
675 class duration_scalar : public chrono_scalar<T> {
676  public:
677  static_assert(is_duration<T>(), "Unexpected non-duration type");
679  using rep_type = typename T::rep;
680 
681  duration_scalar() = delete;
682 
687  duration_scalar(duration_scalar&& other) = default;
688 
697  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
698  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
699 
709  bool is_valid,
710  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
711  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
712 
718 };
719 
723 class list_scalar : public scalar {
724  public:
725  list_scalar() = delete;
726  ~list_scalar() override = default;
727 
732  list_scalar(list_scalar&& other) = default;
733 
734  list_scalar& operator=(list_scalar const& other) = delete;
735  list_scalar& operator=(list_scalar&& other) = delete;
736 
744  list_scalar(list_scalar const& other,
745  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
746  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
747 
759  bool is_valid = true,
760  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
761  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
762 
772  bool is_valid = true,
773  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
774  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
775 
780  [[nodiscard]] column_view view() const;
781 
782  private:
783  cudf::column _data;
784 };
785 
789 class struct_scalar : public scalar {
790  public:
791  struct_scalar() = delete;
792  ~struct_scalar() override = default;
793 
798  struct_scalar(struct_scalar&& other) = default;
799  struct_scalar& operator=(struct_scalar const& other) = delete;
800  struct_scalar& operator=(struct_scalar&& other) = delete;
801 
810  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
811  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
812 
824  bool is_valid = true,
825  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
826  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
827 
839  bool is_valid = true,
840  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
841  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
842 
855  bool is_valid = true,
856  rmm::cuda_stream_view stream = rmm::cuda_stream_default,
857  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
858 
863  [[nodiscard]] table_view view() const;
864 
865  private:
866  table _data;
867 
869  void superimpose_nulls(rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr);
870 };
871  // end of group
873 } // namespace cudf
cudf::duration_scalar::duration_scalar
duration_scalar(duration_scalar &&other)=default
Move constructor for duration_scalar.
cudf::numeric_scalar::numeric_scalar
numeric_scalar(rmm::device_scalar< T > &&data, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new numeric scalar object from existing device memory.
cudf::detail::fixed_width_scalar::value_type
T value_type
Type of the value held by the scalar.
Definition: scalar.hpp:144
cudf::column
A container of nullable device data as a column of elements.
Definition: column.hpp:45
cudf::detail::fixed_width_scalar::fixed_width_scalar
fixed_width_scalar(fixed_width_scalar const &other, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new fixed-width scalar object by deep copying another.
cudf::fixed_point_scalar::fixed_point_scalar
fixed_point_scalar(fixed_point_scalar const &other, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new fixed_point scalar object by deep copying another.
cudf::numeric_scalar::numeric_scalar
numeric_scalar(numeric_scalar &&other)=default
Move constructor for numeric_scalar.
cudf::timestamp_scalar
An owning class to represent a timestamp value in device memory.
Definition: scalar.hpp:620
cudf::scalar::validity_data
bool * validity_data()
Returns a raw pointer to the validity bool in device memory.
cudf::timestamp_scalar::timestamp_scalar
timestamp_scalar(timestamp_scalar &&other)=default
Move constructor for timestamp_scalar.
cudf::duration_scalar::rep_type
typename T::rep rep_type
The duration's underlying representation type.
Definition: scalar.hpp:679
cudf::scalar::scalar
scalar(data_type type, bool is_valid=false, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new scalar object.
cudf::detail::fixed_width_scalar::data
T const * data() const
Returns a const raw pointer to the value in device memory.
cudf::size_type
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:84
cudf::fixed_point_scalar::fixed_point_value
T fixed_point_value(rmm::cuda_stream_view stream=rmm::cuda_stream_default) const
Get the decimal32, decimal64 or decimal128.
column.hpp
Class definition for cudf::column.
cudf::fixed_point_scalar::value_type
T value_type
The value type of the fixed_point number.
Definition: scalar.hpp:306
cudf::scalar::_is_valid
rmm::device_scalar< bool > _is_valid
Device bool signifying validity.
Definition: scalar.hpp:95
cudf::column_view
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
Definition: column_view.hpp:300
cudf::fixed_point_scalar::fixed_point_scalar
fixed_point_scalar(fixed_point_scalar &&other)=default
Move constructor for fixed_point_scalar.
cudf::scalar::_type
data_type _type
Logical type of value in the scalar.
Definition: scalar.hpp:94
cudf::host_span
Definition: span.hpp:130
cudf::fixed_point_scalar::fixed_point_scalar
fixed_point_scalar(T value, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new fixed_point scalar object from a fixed_point number.
types.hpp
Type declarations for libcudf.
rmm
cudf::string_view
A non-owning, immutable view of device data that is a variable length char array representing a UTF-8...
Definition: string_view.hpp:49
cudf::list_scalar::list_scalar
list_scalar(cudf::column &&data, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new list scalar object from existing column.
cudf::timestamp_scalar::rep_type
typename T::rep rep_type
The underlying representation type of the timestamp.
Definition: scalar.hpp:624
rmm::cuda_stream_view
cudf::struct_scalar
An owning class to represent a struct value in device memory.
Definition: scalar.hpp:789
cudf::table
A set of cudf::column's of the same size.
Definition: table.hpp:38
cudf::fixed_point_scalar::fixed_point_scalar
fixed_point_scalar(rep_type value, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new fixed_point scalar object from a value and default 0-scale.
cudf::struct_scalar::struct_scalar
struct_scalar(struct_scalar const &other, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new struct scalar object by deep copying another.
cudf::fixed_point_scalar::data
rep_type * data()
Returns a raw pointer to the value in device memory.
cudf::duration_scalar::count
rep_type count()
Returns the duration in number of ticks.
cudf::fixed_point_scalar::_data
rmm::device_scalar< rep_type > _data
device memory containing the value
Definition: scalar.hpp:421
cudf::string_scalar::to_string
std::string to_string(rmm::cuda_stream_view stream=rmm::cuda_stream_default) const
Get the value of the scalar in a host std::string.
cudf::struct_scalar::struct_scalar
struct_scalar(table_view const &data, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new struct scalar object from table_view.
cudf::duration_scalar::duration_scalar
duration_scalar(duration_scalar const &other, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new duration scalar object by deep copying another.
cudf::fixed_point_scalar::data
rep_type const * data() const
Returns a const raw pointer to the value in device memory.
cudf::chrono_scalar::chrono_scalar
chrono_scalar(rmm::device_scalar< T > &&data, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new chrono scalar object from existing device memory.
cudf::list_scalar::list_scalar
list_scalar(list_scalar const &other, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new list scalar object by deep copying another.
cudf::fixed_point_scalar::fixed_point_scalar
fixed_point_scalar(rmm::device_scalar< rep_type > &&data, numeric::scale_type scale, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new fixed_point scalar object from existing device memory.
cudf::string_scalar::string_scalar
string_scalar(rmm::device_scalar< value_type > &data, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new string scalar object from string_view in device memory.
cudf::string_scalar::string_scalar
string_scalar(rmm::device_buffer &&data, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new string scalar object by moving an existing string data buffer.
cudf::detail::fixed_width_scalar::value
T value(rmm::cuda_stream_view stream=rmm::cuda_stream_default) const
Get the value of the scalar.
cudf::struct_scalar::struct_scalar
struct_scalar(table &&data, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new struct scalar object from an existing table in device memory.
cudf::duration_scalar
An owning class to represent a duration value in device memory.
Definition: scalar.hpp:675
cudf::numeric_scalar::numeric_scalar
numeric_scalar(numeric_scalar const &other, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new numeric scalar object by deep copying another.
rmm::device_buffer
cudf::scalar::scalar
scalar(scalar const &other, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new scalar object by deep copying another.
cudf::list_scalar::list_scalar
list_scalar(cudf::column_view const &data, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new list scalar object from column_view.
device_buffer.hpp
cudf::duration_scalar::duration_scalar
duration_scalar(rep_type value, bool is_valid, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new duration scalar object from tick counts.
cudf::scalar
An owning class to represent a singular value.
Definition: scalar.hpp:46
cudf::string_scalar::data
const char * data() const
Returns a raw pointer to the string in device memory.
cudf::numeric_scalar
An owning class to represent a numerical value in device memory.
Definition: scalar.hpp:241
cudf::table_view
A set of cudf::column_view's of the same size.
Definition: table_view.hpp:154
cudf::detail::fixed_width_scalar::fixed_width_scalar
fixed_width_scalar(T value, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new fixed width scalar object.
cudf::detail::fixed_width_scalar
An owning class to represent a fixed-width type value in device memory.
Definition: scalar.hpp:140
cudf::data_type
Indicator for the logical data type of an element in a column.
Definition: types.hpp:240
cudf::detail::fixed_width_scalar::_data
rmm::device_scalar< T > _data
device memory containing the value
Definition: scalar.hpp:202
cudf::chrono_scalar::chrono_scalar
chrono_scalar(T value, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new chrono scalar object.
cudf::fixed_point_scalar
An owning class to represent a fixed_point number in device memory.
Definition: scalar.hpp:301
cudf::chrono_scalar
An owning class to represent a timestamp/duration value in device memory.
Definition: scalar.hpp:559
cudf::timestamp_scalar::ticks_since_epoch
rep_type ticks_since_epoch()
Returns the duration in number of ticks since the UNIX epoch.
cudf::detail::fixed_width_scalar::data
T * data()
Returns a raw pointer to the value in device memory.
cudf::detail::fixed_width_scalar::fixed_width_scalar
fixed_width_scalar(rmm::device_scalar< T > &&data, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new fixed width scalar object from existing device memory.
cudf::string_scalar::value
value_type value(rmm::cuda_stream_view stream=rmm::cuda_stream_default) const
Get the value of the scalar as a string_view.
cudf::fixed_point_scalar::value
rep_type value(rmm::cuda_stream_view stream=rmm::cuda_stream_default) const
Get the value of the scalar.
cudf
cuDF interfaces
Definition: aggregation.hpp:34
cudf::struct_scalar::struct_scalar
struct_scalar(host_span< column_view const > data, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new struct scalar object from a host_span of column_views.
cudf::string_scalar::size
size_type size() const
Returns the size of the string in bytes.
cudf::string_scalar::string_scalar
string_scalar(std::string const &string, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new string scalar object.
cudf::list_scalar
An owning class to represent a list value in device memory.
Definition: scalar.hpp:723
cudf::scalar::is_valid
bool is_valid(rmm::cuda_stream_view stream=rmm::cuda_stream_default) const
Indicates whether the scalar contains a valid value.
rmm::device_scalar< bool >
cudf::string_scalar::string_scalar
string_scalar(string_scalar &&other)=default
Move constructor for string_scalar.
cudf::struct_scalar::view
table_view view() const
Returns a non-owning, immutable view to underlying device data.
table.hpp
Class definition for cudf::table.
cudf::string_scalar
An owning class to represent a string in device memory.
Definition: scalar.hpp:427
cudf::scalar::scalar
scalar(scalar &&other)=default
Move constructor for scalar.
cudf::string_scalar::string_scalar
string_scalar(value_type const &source, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new string scalar object from string_view.
cudf::detail::fixed_width_scalar::fixed_width_scalar
fixed_width_scalar(fixed_width_scalar &&other)=default
Move constructor for fixed_width_scalar.
cudf::list_scalar::list_scalar
list_scalar(list_scalar &&other)=default
Move constructor for list_scalar.
cudf::chrono_scalar::chrono_scalar
chrono_scalar(chrono_scalar &&other)=default
Move constructor for chrono_scalar.
cudf::timestamp_scalar::timestamp_scalar
timestamp_scalar(timestamp_scalar const &other, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new timestamp scalar object by deep copying another.
cudf::list_scalar::view
column_view view() const
Returns a non-owning, immutable view to underlying device data.
cudf::detail::fixed_width_scalar::set_value
void set_value(T value, rmm::cuda_stream_view stream=rmm::cuda_stream_default)
Set the value of the scalar.
cudf::fixed_point_scalar::rep_type
typename T::rep rep_type
The representation type of the fixed_point number.
Definition: scalar.hpp:305
cudf::scalar::type
data_type type() const noexcept
Returns the scalar's logical value type.
rmm::mr::device_memory_resource
traits.hpp
cudf::fixed_point_scalar::fixed_point_scalar
fixed_point_scalar(rep_type value, numeric::scale_type scale, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new fixed_point scalar object from already shifted value and scale.
cudf::scalar::set_valid_async
void set_valid_async(bool is_valid, rmm::cuda_stream_view stream=rmm::cuda_stream_default)
Updates the validity of the value.
cudf::numeric_scalar::numeric_scalar
numeric_scalar(T value, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new numeric scalar object.
cudf::chrono_scalar::chrono_scalar
chrono_scalar(chrono_scalar const &other, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new chrono scalar object by deep copying another.
cudf::string_scalar::string_scalar
string_scalar(string_scalar const &other, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new string scalar object by deep copying another string_scalar.
cudf::struct_scalar::struct_scalar
struct_scalar(struct_scalar &&other)=default
Move constructor for struct_scalar.
cudf::timestamp_scalar::timestamp_scalar
timestamp_scalar(Duration2 const &value, bool is_valid, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Construct a new timestamp scalar object from a duration that is convertible to T::duration.
cudf::string_scalar::_data
rmm::device_buffer _data
device memory containing the string
Definition: scalar.hpp:549