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