| 246 | } |
| 247 | |
| 248 | Status MakeRandomBooleanArray(const int length, bool include_nulls, |
| 249 | std::shared_ptr<Array>* out) { |
| 250 | std::vector<uint8_t> values(length); |
| 251 | random_null_bytes(length, 0.5, values.data()); |
| 252 | ARROW_ASSIGN_OR_RAISE(auto data, arrow::internal::BytesToBits(values)); |
| 253 | |
| 254 | if (include_nulls) { |
| 255 | std::vector<uint8_t> valid_bytes(length); |
| 256 | ARROW_ASSIGN_OR_RAISE(auto null_bitmap, arrow::internal::BytesToBits(valid_bytes)); |
| 257 | random_null_bytes(length, 0.1, valid_bytes.data()); |
| 258 | *out = std::make_shared<BooleanArray>(length, data, null_bitmap, -1); |
| 259 | } else { |
| 260 | *out = std::make_shared<BooleanArray>(length, data, NULLPTR, 0); |
| 261 | } |
| 262 | return Status::OK(); |
| 263 | } |
| 264 | |
| 265 | Status MakeBooleanBatchSized(const int length, std::shared_ptr<RecordBatch>* out) { |
| 266 | // Make the schema |
no test coverage detected