Skip to content

Commit

Permalink
Fix assert failure for range window functions (#14168)
Browse files Browse the repository at this point in the history
Authors:
  - MithunR (https://github.com/mythrocks)
  - Yunsong Wang (https://github.com/PointKernel)

Approvers:
  - Divye Gala (https://github.com/divyegala)
  - David Wendt (https://github.com/davidwendt)
  - Yunsong Wang (https://github.com/PointKernel)

URL: #14168
  • Loading branch information
mythrocks authored Sep 23, 2023
1 parent 71f30be commit d67cc5d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions cpp/src/rolling/grouped_rolling.cu
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,28 @@ template <typename T>
struct device_value_accessor {
column_device_view const col; ///< column view of column in device

/// Checks that the type used to access device values matches the rep-type
/// of the order-by column.
struct is_correct_range_rep {
template <typename U> /// Order-by type.
constexpr bool operator()() const
{
return std::is_same_v<T, cudf::detail::range_rep_type<U>>;
}
};

/**
* @brief constructor
*
* @param[in] col_ column device view of cudf column
*/
explicit __device__ device_value_accessor(column_device_view const& col_) : col{col_}
{
cudf_assert(type_id_matches_device_storage_type<T>(col.type().id()) &&
"the data type mismatch");
// For non-timestamp types, T must match the order-by column's type.
// For timestamp types, T must match the range rep type for the order-by column.
cudf_assert((type_id_matches_device_storage_type<T>(col.type().id()) or
cudf::type_dispatcher(col.type(), is_correct_range_rep{})) &&
"data type mismatch when accessing the order-by column");
}

/**
Expand Down

0 comments on commit d67cc5d

Please sign in to comment.