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

Function GetBatchesWithNullProbability

cpp/src/arrow/acero/filter_benchmark.cc:43–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41// belonging to a boolean field is true.
42
43static std::shared_ptr<arrow::RecordBatch> GetBatchesWithNullProbability(
44 const FieldVector& fields, int64_t length, double null_probability,
45 double bool_true_probability = 0.5) {
46 std::vector<std::shared_ptr<Array>> arrays(fields.size());
47 auto rand = random::RandomArrayGenerator(kSeed);
48 for (size_t i = 0; i < fields.size(); i++) {
49 const auto& field = fields[i];
50 if (field.get()->name() == "bool") {
51 arrays[i] = rand.Boolean(length, bool_true_probability, null_probability);
52 } else {
53 arrays[i] = rand.ArrayOf(field.get()->type(), length, null_probability);
54 }
55 }
56 return RecordBatch::Make(schema(fields), length, std::move(arrays));
57}
58
59BatchesWithSchema MakeRandomBatchesWithNullProbability(
60 std::shared_ptr<Schema> schema, int num_batches, int batch_size,

Callers 1

Calls 8

MakeFunction · 0.50
schemaFunction · 0.50
sizeMethod · 0.45
nameMethod · 0.45
getMethod · 0.45
BooleanMethod · 0.45
ArrayOfMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected