range_window_bounds.hpp
前往此文件的文档。
1 /*
2  * 版权所有 (c) 2021-2024, NVIDIA CORPORATION。
3  *
4  * 根据 Apache 许可证 2.0 版(“许可证”)获得许可;
5  * 除非遵守许可证,否则您不得使用此文件。
6  * 您可以获取一份许可证副本,地址为
7  *
8  * https://apache.ac.cn/licenses/LICENSE-2.0
9  *
10  * 除非适用法律要求或书面同意,否则软件
11  * 根据许可证分发,基于“现状”提供,
12  * 不附带任何明示或暗示的保证或条件。
13  * 请参阅许可证,了解管理权限和
14  * 限制的具体语言。
15  */
16 
17 #pragma once
18 
19 #include <cudf/scalar/scalar.hpp>
20 #include <cudf/utilities/export.hpp>
21 
22 namespace CUDF_EXPORT cudf {
45  public
49  /**
50  * @brief The type of range_window_bounds.
51  */
53  enum class extent_type : int32_t {
54  CURRENT_ROW = 0,
55  BOUNDED,
63  UNBOUNDED
64  };
65 
74  /**
75  * @brief Factory method to construct a bounded window boundary.
76  *
83  * @param boundary scalar value for the boundary
84  * @param stream CUDA stream used for device memory operations
92  */
93  static range_window_bounds get(scalar const& boundary,
95 
101  /**
102  * @brief Factory method to construct a window boundary limited to the value of the current row.
108  *
109  * @param type The data type of the column that the window is being applied to
1010  * @param stream CUDA stream used for device memory operations
1011  */
1014 
1015  /**
1016  * @brief Whether or not the window is bounded to the current row.
1017  */
1018  [[nodiscard]] bool is_current_row() const { return _extent == extent_type::CURRENT_ROW; }
1019 
1020  /**
1021  * @brief Factory method to construct an unbounded window boundary.
1022  *
1023  * @param type The data type of the column that the window is being applied to
1024  * @param stream CUDA stream used for device memory operations
1025  */
1028 
1029  /**
10030  * @brief Whether or not the window is unbounded.
10031  */
10032  [[nodiscard]] bool is_unbounded() const { return _extent == extent_type::UNBOUNDED; }
10033 
10034  /**
10035  * @brief Returns the underlying scalar value for the bounds.
10036  *
10037  * @throw cudf::logic_error if extent is not `BOUNDED`
10038  */
10039  [[nodiscard]] scalar const& range_scalar() const { return *_range_scalar; }
10040 
10041  /**
10042  * @brief Copy constructor.
10043  */
10044  range_window_bounds(range_window_bounds const&) = default;
10045  range_window_bounds() = default; // 调度 functor 作为返回类型时必需。
10046 
10047  private
10048  extent_type _extent{extent_type::UNBOUNDED};
10049  std::shared_ptr<scalar> _range_scalar{nullptr}; // 启用复制构造/赋值。
10050 
10051  range_window_bounds(extent_type extent_,
10052  std::unique_ptr<scalar> range_scalar_,
10054 };
10055  // 组结束
10056 } // namespace CUDF_EXPORT cudf
cudf::data_type
列中元素逻辑数据类型的指示符。
定义: types.hpp:243
表示单个值的拥有类。
定义: scalar.hpp:51
cudf::get_default_stream
rmm::cuda_stream_view const get_default_stream()
获取当前默认流。