| 491 | } |
| 492 | |
| 493 | Status MakeFixedSizeListRecordBatch(std::shared_ptr<RecordBatch>* out) { |
| 494 | // Make the schema |
| 495 | auto f0 = field("f0", fixed_size_list(int32(), 1)); |
| 496 | auto f1 = field("f1", fixed_size_list(list(int32()), 3)); |
| 497 | auto f2 = field("f2", int32()); |
| 498 | auto schema = ::arrow::schema({f0, f1, f2}); |
| 499 | |
| 500 | // Example data |
| 501 | |
| 502 | MemoryPool* pool = default_memory_pool(); |
| 503 | const int length = 200; |
| 504 | std::shared_ptr<Array> leaf_values, list_array, list_list_array, flat_array; |
| 505 | const bool include_nulls = true; |
| 506 | RETURN_NOT_OK(MakeRandomInt32Array(1000, include_nulls, pool, &leaf_values)); |
| 507 | RETURN_NOT_OK( |
| 508 | MakeRandomListArray(leaf_values, length * 3, include_nulls, pool, &list_array)); |
| 509 | list_list_array = std::make_shared<FixedSizeListArray>(f1->type(), length, list_array); |
| 510 | list_array = std::make_shared<FixedSizeListArray>(f0->type(), length, |
| 511 | leaf_values->Slice(0, length)); |
| 512 | RETURN_NOT_OK(MakeRandomInt32Array(length, include_nulls, pool, &flat_array)); |
| 513 | *out = RecordBatch::Make(schema, length, {list_array, list_list_array, flat_array}); |
| 514 | return Status::OK(); |
| 515 | } |
| 516 | |
| 517 | Status MakeZeroLengthRecordBatch(std::shared_ptr<RecordBatch>* out) { |
| 518 | // Make the schema |
no test coverage detected