Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix decimal -> float cast in ast code #16038

Merged
merged 3 commits into from
Jun 14, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion cpp/include/cudf/ast/detail/operators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <cudf/ast/expressions.hpp>
#include <cudf/types.hpp>
#include <cudf/unary.hpp>
#include <cudf/utilities/error.hpp>
#include <cudf/utilities/type_dispatcher.hpp>

Expand Down Expand Up @@ -819,7 +820,17 @@ struct operator_functor<ast_operator::NOT, false> {
template <typename To>
struct cast {
static constexpr auto arity{1};
template <typename From>
template <typename From, typename cuda::std::enable_if_t<is_fixed_point<From>()>* = nullptr>
pmattione-nvidia marked this conversation as resolved.
Show resolved Hide resolved
__device__ inline auto operator()(From f) -> To
{
if constexpr (cuda::std::is_floating_point_v<To>) {
return convert_fixed_to_floating<To>(f);
} else {
return static_cast<To>(f);
}
}

template <typename From, typename cuda::std::enable_if_t<!is_fixed_point<From>()>* = nullptr>
vyasr marked this conversation as resolved.
Show resolved Hide resolved
__device__ inline auto operator()(From f) -> decltype(static_cast<To>(f))
{
return static_cast<To>(f);
Expand Down
Loading