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

Function MakeListRecordBatchSized

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

Source from the content-addressed store, hash-verified

435}
436
437Status 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
461Status MakeListRecordBatch(std::shared_ptr<RecordBatch>* out) {
462 return MakeListRecordBatchSized(200, out);

Callers 2

MakeListRecordBatchFunction · 0.85
TEST_PFunction · 0.85

Calls 10

listFunction · 0.85
large_listFunction · 0.85
default_memory_poolFunction · 0.85
MakeRandomInt32ArrayFunction · 0.85
MakeRandomListArrayFunction · 0.85
MakeRandomLargeListArrayFunction · 0.85
schemaFunction · 0.70
fieldFunction · 0.50
MakeFunction · 0.50
OKFunction · 0.50

Tested by

no test coverage detected