| 435 | } |
| 436 | |
| 437 | Status MakeListRecordBatchSized(const int length, std::shared_ptr<RecordBatch>* out) { |
| 438 | // Make the schema |
| 439 | auto f0 = field("f0", list(int32())); |
| 440 | auto f1 = field("f1", list(list(int32()))); |
| 441 | auto f2 = field("f2", large_list(int32())); |
| 442 | auto schema = ::arrow::schema({f0, f1, f2}); |
| 443 | |
| 444 | // Example data |
| 445 | |
| 446 | MemoryPool* pool = default_memory_pool(); |
| 447 | std::shared_ptr<Array> leaf_values, list_array, list_list_array, large_list_array; |
| 448 | const bool include_nulls = true; |
| 449 | RETURN_NOT_OK(MakeRandomInt32Array(1000, include_nulls, pool, &leaf_values)); |
| 450 | RETURN_NOT_OK( |
| 451 | MakeRandomListArray(leaf_values, length, include_nulls, pool, &list_array)); |
| 452 | RETURN_NOT_OK( |
| 453 | MakeRandomListArray(list_array, length, include_nulls, pool, &list_list_array)); |
| 454 | RETURN_NOT_OK(MakeRandomLargeListArray(leaf_values, length, include_nulls, pool, |
| 455 | &large_list_array)); |
| 456 | *out = |
| 457 | RecordBatch::Make(schema, length, {list_array, list_list_array, large_list_array}); |
| 458 | return Status::OK(); |
| 459 | } |
| 460 | |
| 461 | Status MakeListRecordBatch(std::shared_ptr<RecordBatch>* out) { |
| 462 | return MakeListRecordBatchSized(200, out); |
no test coverage detected