| 2261 | |
| 2262 | template <typename ValuesType, typename IndexType> |
| 2263 | void CheckTakeRandom(const std::shared_ptr<Array>& values, int64_t indices_length, |
| 2264 | double null_probability, random::RandomArrayGenerator* rand) { |
| 2265 | using IndexCType = typename IndexType::c_type; |
| 2266 | IndexCType max_index = GetMaxIndex<IndexCType>(values->length()); |
| 2267 | auto indices = rand->Numeric<IndexType>(indices_length, static_cast<IndexCType>(0), |
| 2268 | max_index, null_probability); |
| 2269 | auto indices_no_nulls = rand->Numeric<IndexType>( |
| 2270 | indices_length, static_cast<IndexCType>(0), max_index, /*null_probability=*/0.0); |
| 2271 | ValidateTakeXA<ValuesType>(values, indices); |
| 2272 | ValidateTakeXA<ValuesType>(values, indices_no_nulls); |
| 2273 | // Sliced indices array |
| 2274 | if (indices_length >= 2) { |
| 2275 | indices = indices->Slice(1, indices_length - 2); |
| 2276 | indices_no_nulls = indices_no_nulls->Slice(1, indices_length - 2); |
| 2277 | ValidateTakeXA<ValuesType>(values, indices); |
| 2278 | ValidateTakeXA<ValuesType>(values, indices_no_nulls); |
| 2279 | } |
| 2280 | } |
| 2281 | |
| 2282 | template <typename ValuesType> |
| 2283 | struct TakeRandomTest { |