dinse commented on code in PR #46829:
URL: https://github.com/apache/arrow/pull/46829#discussion_r2155730413
##########
cpp/src/arrow/compute/kernels/scalar_validity.cc:
##########
@@ -60,13 +61,25 @@ Status IsValidExec(KernelContext* ctx, const ExecSpan&
batch, ExecResult* out) {
struct IsFiniteOperator {
template <typename OutType, typename InType>
static constexpr OutType Call(KernelContext*, const InType& value, Status*) {
+ // this is HalfFloatType, because int types call a different operator
+ if constexpr(std::is_same_v<InType, uint16_t>) {
+ using ::arrow::util::Float16;
+ return Float16::FromBits(static_cast<uint16_t>(value)).is_finite();
+ }
+
return std::isfinite(value);
}
};
struct IsInfOperator {
template <typename OutType, typename InType>
static constexpr OutType Call(KernelContext*, const InType& value, Status*) {
+ // this is HalfFloatType, because int types call a different operator
+ if constexpr(std::is_same_v<InType, uint16_t>) {
+ using ::arrow::util::Float16;
+ return Float16::FromBits(static_cast<uint16_t>(value)).is_infinity();
Review Comment:
Fixed
##########
cpp/src/arrow/compute/kernels/scalar_validity.cc:
##########
@@ -60,13 +61,25 @@ Status IsValidExec(KernelContext* ctx, const ExecSpan&
batch, ExecResult* out) {
struct IsFiniteOperator {
template <typename OutType, typename InType>
static constexpr OutType Call(KernelContext*, const InType& value, Status*) {
+ // this is HalfFloatType, because int types call a different operator
+ if constexpr(std::is_same_v<InType, uint16_t>) {
+ using ::arrow::util::Float16;
+ return Float16::FromBits(static_cast<uint16_t>(value)).is_finite();
Review Comment:
Fixed
##########
cpp/src/arrow/compute/kernels/base_arithmetic_internal.h:
##########
@@ -652,6 +666,18 @@ struct Sign {
}
};
+struct SignHalfFloat {
+ template <typename T, typename Arg>
+ static constexpr enable_if_unsigned_integer_value<Arg, T>
Call(KernelContext*, Arg arg,
Review Comment:
Fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]