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

Function GenerateTestArray

cpp/src/arrow/type_benchmark.cc:451–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449}
450
451static std::shared_ptr<Array> GenerateTestArray(int num_columns) {
452 constexpr int64_t kLength = 100;
453
454 auto rand = random::RandomArrayGenerator(0xbeef);
455 auto schm = GenerateTestSchema(num_columns);
456
457 ArrayVector columns(num_columns);
458 for (auto& column : columns) {
459 column = rand.Int64(kLength, 0, std::numeric_limits<int64_t>::max());
460 }
461
462 return *StructArray::Make(columns, schm->fields());
463}
464
465static std::shared_ptr<RecordBatch> ToBatch(const std::shared_ptr<Array>& array) {
466 return *RecordBatch::FromStructArray(array);

Calls 4

GenerateTestSchemaFunction · 0.85
MakeFunction · 0.70
Int64Method · 0.45
fieldsMethod · 0.45

Tested by

no test coverage detected