| 463 | } |
| 464 | |
| 465 | Status MakeListViewRecordBatchSized(const int length, std::shared_ptr<RecordBatch>* out) { |
| 466 | // Make the schema |
| 467 | auto f0 = field("f0", list_view(int32())); |
| 468 | auto f1 = field("f1", list_view(list_view(int32()))); |
| 469 | auto f2 = field("f2", large_list_view(int32())); |
| 470 | auto schema = ::arrow::schema({f0, f1, f2}); |
| 471 | |
| 472 | // Example data |
| 473 | |
| 474 | MemoryPool* pool = default_memory_pool(); |
| 475 | std::shared_ptr<Array> leaf_values, list_array, list_list_array, large_list_array; |
| 476 | const bool include_nulls = true; |
| 477 | RETURN_NOT_OK(MakeRandomInt32Array(1000, include_nulls, pool, &leaf_values)); |
| 478 | RETURN_NOT_OK( |
| 479 | MakeRandomListViewArray(leaf_values, length, include_nulls, pool, &list_array)); |
| 480 | RETURN_NOT_OK( |
| 481 | MakeRandomListViewArray(list_array, length, include_nulls, pool, &list_list_array)); |
| 482 | RETURN_NOT_OK(MakeRandomLargeListViewArray(leaf_values, length, include_nulls, pool, |
| 483 | &large_list_array)); |
| 484 | *out = |
| 485 | RecordBatch::Make(schema, length, {list_array, list_list_array, large_list_array}); |
| 486 | return Status::OK(); |
| 487 | } |
| 488 | |
| 489 | Status MakeListViewRecordBatch(std::shared_ptr<RecordBatch>* out) { |
| 490 | return MakeListViewRecordBatchSized(200, out); |
no test coverage detected