| 408 | |
| 409 | template <typename T> |
| 410 | static inline enable_if_primitive_ctype<typename CTypeTraits<T>::ArrowType, Result<T>> |
| 411 | GenericFromScalar(const std::shared_ptr<Scalar>& value) { |
| 412 | using ArrowType = typename CTypeTraits<T>::ArrowType; |
| 413 | using ScalarType = typename TypeTraits<ArrowType>::ScalarType; |
| 414 | if (value->type->id() != ArrowType::type_id) { |
| 415 | return Status::Invalid("Expected type ", ArrowType::type_id, " but got ", |
| 416 | value->type->ToString()); |
| 417 | } |
| 418 | const auto& holder = checked_cast<const ScalarType&>(*value); |
| 419 | if (!holder.is_valid) return Status::Invalid("Got null scalar"); |
| 420 | return holder.value; |
| 421 | } |
| 422 | |
| 423 | template <typename T> |
| 424 | static inline enable_if_primitive_ctype<typename EnumTraits<T>::Type, Result<T>> |
no test coverage detected