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

Function GenerateTestArray

cpp/src/arrow/type_benchmark.cc:437–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435}
436
437static std::shared_ptr<Array> GenerateTestArray(int num_columns) {
438 constexpr int64_t kLength = 100;
439
440 auto rand = random::RandomArrayGenerator(0xbeef);
441 auto schm = GenerateTestSchema(num_columns);
442
443 ArrayVector columns(num_columns);
444 for (auto& column : columns) {
445 column = rand.Int64(kLength, 0, std::numeric_limits<int64_t>::max());
446 }
447
448 return *StructArray::Make(columns, schm->fields());
449}
450
451static std::shared_ptr<RecordBatch> ToBatch(const std::shared_ptr<Array>& array) {
452 return *RecordBatch::FromStructArray(array);

Calls 4

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

Tested by

no test coverage detected