Skip to content

Commit

Permalink
Fix compile and use TypeClass of Scalar
Browse files Browse the repository at this point in the history
  • Loading branch information
mapleFU committed Jan 29, 2025
1 parent 87b149a commit 22134a8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cpp/src/arrow/scalar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1177,14 +1177,15 @@ enable_if_duration<To, Result<std::shared_ptr<Scalar>>> CastImpl(
}

// time to time
template <typename To, typename From>
template <typename To, typename From,
typename T = typename TypeTraits<To>::ScalarType::TypeClass>
enable_if_time<To, Result<std::shared_ptr<Scalar>>> CastImpl(
const TimeScalar<From>& from, std::shared_ptr<DataType> to_type) {
using ToScalar = typename TypeTraits<To>::ScalarType;
ARROW_ASSIGN_OR_RAISE(
auto value, util::ConvertTimestampValue(AsTimestampType<From>(from.type),
AsTimestampType<To>(to_type), from.value));
return std::make_shared<ToScalar>(value, std::move(to_type));
return std::make_shared<ToScalar>(static_cast<typename To::c_type>(value), std::move(to_type));
}

constexpr int64_t kMillisecondsInDay = 86400000;
Expand Down

0 comments on commit 22134a8

Please sign in to comment.