| 358 | namespace { |
| 359 | |
| 360 | Status CastBuffer(const std::shared_ptr<DataType>& in_type, |
| 361 | const std::shared_ptr<Buffer>& input, const int64_t length, |
| 362 | const std::shared_ptr<Buffer>& valid_bitmap, const int64_t null_count, |
| 363 | const std::shared_ptr<DataType>& out_type, |
| 364 | const compute::CastOptions& cast_options, MemoryPool* pool, |
| 365 | std::shared_ptr<Buffer>* out) { |
| 366 | // Must cast |
| 367 | auto tmp_data = ArrayData::Make(in_type, length, {valid_bitmap, input}, null_count); |
| 368 | compute::ExecContext context(pool); |
| 369 | ARROW_ASSIGN_OR_RAISE( |
| 370 | std::shared_ptr<Array> casted_array, |
| 371 | compute::Cast(*MakeArray(tmp_data), out_type, cast_options, &context)); |
| 372 | *out = casted_array->data()->buffers[1]; |
| 373 | return Status::OK(); |
| 374 | } |
| 375 | |
| 376 | template <typename FromType, typename ToType> |
| 377 | Status StaticCastBuffer(const Buffer& input, const int64_t length, MemoryPool* pool, |
no test coverage detected