Make an array containing only empty lists, with a null values array
| 418 | |
| 419 | // Make an array containing only empty lists, with a null values array |
| 420 | Status MakeEmptyListsArray(int64_t size, std::shared_ptr<Array>* out_array) { |
| 421 | // Allocate an offsets buffer containing only zeroes |
| 422 | const int64_t offsets_nbytes = (size + 1) * sizeof(int32_t); |
| 423 | ARROW_ASSIGN_OR_RAISE(auto offsets_buffer, ::arrow::AllocateBuffer(offsets_nbytes)); |
| 424 | memset(offsets_buffer->mutable_data(), 0, offsets_nbytes); |
| 425 | |
| 426 | auto value_field = |
| 427 | ::arrow::field("item", ::arrow::float64(), false /* nullable_values */); |
| 428 | auto list_type = ::arrow::list(value_field); |
| 429 | |
| 430 | std::vector<std::shared_ptr<Buffer>> child_buffers = {nullptr /* null bitmap */, |
| 431 | nullptr /* values */}; |
| 432 | auto child_data = |
| 433 | ::arrow::ArrayData::Make(value_field->type(), 0, std::move(child_buffers)); |
| 434 | |
| 435 | std::vector<std::shared_ptr<Buffer>> buffers = {nullptr /* bitmap */, |
| 436 | std::move(offsets_buffer)}; |
| 437 | auto array_data = ::arrow::ArrayData::Make(list_type, size, std::move(buffers)); |
| 438 | array_data->child_data.push_back(child_data); |
| 439 | |
| 440 | *out_array = ::arrow::MakeArray(array_data); |
| 441 | return Status::OK(); |
| 442 | } |
| 443 | |
| 444 | std::shared_ptr<::arrow::Table> MakeSimpleTable( |
| 445 | const std::shared_ptr<ChunkedArray>& values, bool nullable) { |
no test coverage detected