| 41 | // belonging to a boolean field is true. |
| 42 | |
| 43 | static 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 | |
| 59 | BatchesWithSchema MakeRandomBatchesWithNullProbability( |
| 60 | std::shared_ptr<Schema> schema, int num_batches, int batch_size, |