| 286 | } |
| 287 | |
| 288 | Result<std::shared_ptr<ChunkedArray>> ViewOrCastChunkedArray( |
| 289 | const std::shared_ptr<ChunkedArray>& array, MemoryPool* pool, |
| 290 | const std::shared_ptr<DataType>& logical_value_type) { |
| 291 | auto view_result = array->View(logical_value_type); |
| 292 | if (view_result.ok()) { |
| 293 | return view_result.ValueOrDie(); |
| 294 | } else { |
| 295 | ::arrow::compute::ExecContext exec_context(pool); |
| 296 | ARROW_ASSIGN_OR_RAISE( |
| 297 | auto casted_datum, |
| 298 | ::arrow::compute::Cast(Datum(array), logical_value_type, |
| 299 | ::arrow::compute::CastOptions(), &exec_context)); |
| 300 | return casted_datum.chunked_array(); |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | } // namespace |
| 305 |
no test coverage detected