| 174 | |
| 175 | template <typename ArrowType, typename OptionType> |
| 176 | std::shared_ptr<NumericArray<ArrowType>> GenerateNumericArray(int64_t size, |
| 177 | OptionType options, |
| 178 | int64_t alignment, |
| 179 | MemoryPool* memory_pool) { |
| 180 | using CType = typename ArrowType::c_type; |
| 181 | auto type = TypeTraits<ArrowType>::type_singleton(); |
| 182 | BufferVector buffers{2}; |
| 183 | |
| 184 | int64_t null_count = 0; |
| 185 | buffers[0] = *AllocateEmptyBitmap(size, alignment, memory_pool); |
| 186 | options.GenerateBitmap(buffers[0]->mutable_data(), size, &null_count); |
| 187 | |
| 188 | buffers[1] = *AllocateBuffer(sizeof(CType) * size, alignment, memory_pool); |
| 189 | options.GenerateData(buffers[1]->mutable_data(), size); |
| 190 | if (std::is_same<ArrowType, Date64Type>::value) { |
| 191 | GenerateFullDayMillisNoNan(buffers[1]->mutable_data(), size); |
| 192 | } |
| 193 | |
| 194 | auto array_data = ArrayData::Make(type, size, buffers, null_count); |
| 195 | return std::make_shared<NumericArray<ArrowType>>(array_data); |
| 196 | } |
| 197 | |
| 198 | } // namespace |
| 199 |
nothing calls this directly
no test coverage detected