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