| 275 | |
| 276 | template <typename ArrowType, typename CType = typename ArrowType::c_type> |
| 277 | std::shared_ptr<Array> Numeric(int64_t size, CType min, CType max, |
| 278 | double null_probability = 0, |
| 279 | int64_t alignment = kDefaultBufferAlignment, |
| 280 | MemoryPool* memory_pool = default_memory_pool()) { |
| 281 | switch (ArrowType::type_id) { |
| 282 | case Type::UINT8: |
| 283 | return UInt8(size, static_cast<uint8_t>(min), static_cast<uint8_t>(max), |
| 284 | null_probability, alignment, memory_pool); |
| 285 | case Type::INT8: |
| 286 | return Int8(size, static_cast<int8_t>(min), static_cast<int8_t>(max), |
| 287 | null_probability, alignment, memory_pool); |
| 288 | case Type::UINT16: |
| 289 | return UInt16(size, static_cast<uint16_t>(min), static_cast<uint16_t>(max), |
| 290 | null_probability, alignment, memory_pool); |
| 291 | case Type::INT16: |
| 292 | return Int16(size, static_cast<int16_t>(min), static_cast<int16_t>(max), |
| 293 | null_probability, alignment, memory_pool); |
| 294 | case Type::UINT32: |
| 295 | return UInt32(size, static_cast<uint32_t>(min), static_cast<uint32_t>(max), |
| 296 | null_probability, alignment, memory_pool); |
| 297 | case Type::INT32: |
| 298 | return Int32(size, static_cast<int32_t>(min), static_cast<int32_t>(max), |
| 299 | null_probability, alignment, memory_pool); |
| 300 | case Type::UINT64: |
| 301 | return UInt64(size, static_cast<uint64_t>(min), static_cast<uint64_t>(max), |
| 302 | null_probability, alignment, memory_pool); |
| 303 | case Type::INT64: |
| 304 | return Int64(size, static_cast<int64_t>(min), static_cast<int64_t>(max), |
| 305 | null_probability, alignment, memory_pool); |
| 306 | case Type::HALF_FLOAT: |
| 307 | return Float16(size, util::Float16::FromBits(static_cast<uint16_t>(min)), |
| 308 | util::Float16::FromBits(static_cast<uint16_t>(max)), |
| 309 | null_probability, /*nan_probability=*/0, alignment, memory_pool); |
| 310 | case Type::FLOAT: |
| 311 | return Float32(size, static_cast<float>(min), static_cast<float>(max), |
| 312 | null_probability, /*nan_probability=*/0, alignment, memory_pool); |
| 313 | case Type::DOUBLE: |
| 314 | return Float64(size, static_cast<double>(min), static_cast<double>(max), |
| 315 | null_probability, /*nan_probability=*/0, alignment, memory_pool); |
| 316 | case Type::DATE64: |
| 317 | return Date64(size, static_cast<int64_t>(min), static_cast<int64_t>(max), |
| 318 | null_probability, alignment, memory_pool); |
| 319 | default: |
| 320 | return nullptr; |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | /// \brief Generate a random Decimal32Array |
| 325 | /// |
nothing calls this directly
no test coverage detected