MCPcopy Create free account
hub / github.com/apache/arrow / MakeFixedSizeListRecordBatch

Function MakeFixedSizeListRecordBatch

cpp/src/arrow/ipc/test_common.cc:493–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491}
492
493Status 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
517Status MakeZeroLengthRecordBatch(std::shared_ptr<RecordBatch>* out) {
518 // Make the schema

Callers 1

BatchesFunction · 0.85

Calls 11

fixed_size_listFunction · 0.85
listFunction · 0.85
default_memory_poolFunction · 0.85
MakeRandomInt32ArrayFunction · 0.85
MakeRandomListArrayFunction · 0.85
schemaFunction · 0.70
fieldFunction · 0.50
MakeFunction · 0.50
OKFunction · 0.50
typeMethod · 0.45
SliceMethod · 0.45

Tested by

no test coverage detected