| 415 | } |
| 416 | |
| 417 | std::shared_ptr<Array> MakeRandomArray(int64_t size, double null_probability, |
| 418 | int64_t alignment, MemoryPool* memory_pool) { |
| 419 | static constexpr int32_t kMaxDigitsInInteger = |
| 420 | std::is_same_v<DecimalType, Decimal32Type> ? 9 : 18; |
| 421 | static_assert( |
| 422 | kMaxDigitsInInteger >= DecimalType::kByteWidth, |
| 423 | "inconsistent decimal metadata: kMaxPrecision doesn't match kByteWidth"); |
| 424 | |
| 425 | const auto& decimal_type = checked_cast<const DecimalType&>(*type_); |
| 426 | |
| 427 | auto digits_to_generate = decimal_type.precision(); |
| 428 | auto values = checked_pointer_cast<typename TypeTraits<IntArrowType>::ArrayType>( |
| 429 | rng_->Numeric<IntArrowType>(size, -1 * MaxDecimalInteger(digits_to_generate), |
| 430 | MaxDecimalInteger(digits_to_generate), |
| 431 | null_probability, alignment, memory_pool)); |
| 432 | |
| 433 | return values->View(type_).ValueOrDie(); |
| 434 | } |
| 435 | }; |
| 436 | |
| 437 | } // namespace |
nothing calls this directly
no test coverage detected