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

Function MakeBatch

cpp/src/arrow/csv/generate_fuzz_corpus.cc:58–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58Result<std::shared_ptr<RecordBatch>> MakeBatch(
59 std::function<Result<std::shared_ptr<Array>>(int64_t length, double null_probability)>
60 array_factory,
61 int64_t length) {
62 ArrayVector columns;
63 FieldVector fields;
64
65 struct ColumnSpec {
66 std::string name;
67 double null_probability;
68 };
69 for (auto spec : {ColumnSpec{"with_nulls", 0.2}, ColumnSpec{"without_nulls", 0.0}}) {
70 ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Array> column,
71 array_factory(length, spec.null_probability));
72 columns.push_back(column);
73 fields.push_back(field(spec.name, column->type()));
74 }
75 return RecordBatch::Make(schema(std::move(fields)), length, std::move(columns));
76}
77
78Result<RecordBatchVector> Batches() {
79 ::arrow::random::RandomArrayGenerator gen(/*seed=*/42);

Callers 15

MakeBatchMethod · 0.85
AssertCreatedDataMethod · 0.85
TEST_FFunction · 0.85
TestSameDictPointerMethod · 0.85
TestSameDictValuesMethod · 0.85
TestDeltaDictMethod · 0.85

Calls 6

push_backMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.50
fieldFunction · 0.50
MakeFunction · 0.50
schemaFunction · 0.50
typeMethod · 0.45

Tested by 14

MakeBatchMethod · 0.68
AssertCreatedDataMethod · 0.68
TEST_FFunction · 0.68
TestSameDictPointerMethod · 0.68
TestSameDictValuesMethod · 0.68
TestDeltaDictMethod · 0.68