| 975 | } |
| 976 | |
| 977 | std::shared_ptr<Array> RandomArrayGenerator::RunEndEncoded( |
| 978 | std::shared_ptr<DataType> value_type, int64_t logical_size, double null_probability) { |
| 979 | Int32Builder run_ends_builder; |
| 980 | pcg32 rng(seed()); |
| 981 | |
| 982 | DCHECK_LE(logical_size, std::numeric_limits<int32_t>::max()); |
| 983 | |
| 984 | std::uniform_int_distribution<int64_t> distribution(1, 100); |
| 985 | int64_t current_end = 0; |
| 986 | while (current_end < logical_size) { |
| 987 | current_end += distribution(rng); |
| 988 | current_end = std::min(current_end, logical_size); |
| 989 | ARROW_CHECK_OK(run_ends_builder.Append(static_cast<int32_t>(current_end))); |
| 990 | } |
| 991 | |
| 992 | std::shared_ptr<Array> run_ends = *run_ends_builder.Finish(); |
| 993 | std::shared_ptr<Array> values = |
| 994 | ArrayOf(std::move(value_type), run_ends->length(), null_probability); |
| 995 | |
| 996 | return RunEndEncodedArray::Make(logical_size, run_ends, values).ValueOrDie(); |
| 997 | } |
| 998 | |
| 999 | std::shared_ptr<Array> RandomArrayGenerator::SparseUnion(const ArrayVector& fields, |
| 1000 | int64_t size, int64_t alignment, |