| 128 | } |
| 129 | |
| 130 | Result<std::shared_ptr<Array>> GenerateRandomTimestampArray( |
| 131 | int64_t size, std::shared_ptr<TimestampType> type, double null_probability) { |
| 132 | random::RandomArrayGenerator rand(kRandomSeed); |
| 133 | switch (type->unit()) { |
| 134 | case TimeUnit::type::SECOND: { |
| 135 | return CastInt64ArrayToTemporalArray<TimestampArray>( |
| 136 | type, rand.Int64(size, kSecondMin, kSecondMax, null_probability)); |
| 137 | } |
| 138 | case TimeUnit::type::MILLI: { |
| 139 | return CastInt64ArrayToTemporalArray<TimestampArray>( |
| 140 | type, rand.Int64(size, kMilliMin, kMilliMax, null_probability)); |
| 141 | } |
| 142 | case TimeUnit::type::MICRO: { |
| 143 | return CastInt64ArrayToTemporalArray<TimestampArray>( |
| 144 | type, rand.Int64(size, kMicroMin, kMicroMax, null_probability)); |
| 145 | } |
| 146 | case TimeUnit::type::NANO: { |
| 147 | return CastInt64ArrayToTemporalArray<TimestampArray>( |
| 148 | type, rand.Int64(size, kNanoMin, kNanoMax, null_probability)); |
| 149 | } |
| 150 | default: { |
| 151 | return Status::TypeError("Unknown or unsupported Arrow TimeUnit: ", type); |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | /// \brief Construct a random weak composition of a nonnegative integer |
| 157 | /// i.e. a way of writing it as the sum of a sequence of n non-negative |
no test coverage detected