| 390 | |
| 391 | template <typename T> |
| 392 | static inline enable_if_primitive_ctype<typename CTypeTraits<T>::ArrowType, Result<T>> |
| 393 | GenericFromScalar(const std::shared_ptr<Scalar>& value) { |
| 394 | using ArrowType = typename CTypeTraits<T>::ArrowType; |
| 395 | using ScalarType = typename TypeTraits<ArrowType>::ScalarType; |
| 396 | if (value->type->id() != ArrowType::type_id) { |
| 397 | return Status::Invalid("Expected type ", ArrowType::type_id, " but got ", |
| 398 | value->type->ToString()); |
| 399 | } |
| 400 | const auto& holder = checked_cast<const ScalarType&>(*value); |
| 401 | if (!holder.is_valid) return Status::Invalid("Got null scalar"); |
| 402 | return holder.value; |
| 403 | } |
| 404 | |
| 405 | template <typename T> |
| 406 | static inline enable_if_primitive_ctype<typename EnumTraits<T>::Type, Result<T>> |
no test coverage detected