| 177 | } |
| 178 | |
| 179 | std::shared_ptr<ChunkedArray> GenerateRandomChunkedArray( |
| 180 | const std::shared_ptr<DataType>& data_type, int64_t size, int64_t min_num_chunks, |
| 181 | int64_t max_num_chunks, double null_probability) { |
| 182 | random::RandomArrayGenerator rand(kRandomSeed); |
| 183 | std::vector<int64_t> num_chunks(1, 0); |
| 184 | std::vector<int64_t> current_size_chunks; |
| 185 | randint<int64_t, int64_t>(1, min_num_chunks, max_num_chunks, &num_chunks); |
| 186 | int64_t current_num_chunks = num_chunks[0]; |
| 187 | ArrayVector arrays(current_num_chunks, nullptr); |
| 188 | RandWeakComposition(current_num_chunks, size, ¤t_size_chunks); |
| 189 | for (int j = 0; j < current_num_chunks; j++) { |
| 190 | switch (data_type->id()) { |
| 191 | case Type::DATE64: { |
| 192 | EXPECT_OK_AND_ASSIGN(arrays[j], GenerateRandomDate64Array(current_size_chunks[j], |
| 193 | null_probability)); |
| 194 | break; |
| 195 | } |
| 196 | case Type::TIMESTAMP: { |
| 197 | EXPECT_OK_AND_ASSIGN(arrays[j], |
| 198 | GenerateRandomTimestampArray( |
| 199 | current_size_chunks[j], |
| 200 | internal::checked_pointer_cast<TimestampType>(data_type), |
| 201 | null_probability)); |
| 202 | break; |
| 203 | } |
| 204 | default: |
| 205 | arrays[j] = rand.ArrayOf(data_type, current_size_chunks[j], null_probability); |
| 206 | } |
| 207 | } |
| 208 | return std::make_shared<ChunkedArray>(arrays); |
| 209 | } |
| 210 | |
| 211 | std::shared_ptr<Table> GenerateRandomTable(const std::shared_ptr<Schema>& schema, |
| 212 | int64_t size, int64_t min_num_chunks, |
no test coverage detected