| 281 | |
| 282 | template <TypeKind kind> |
| 283 | static VectorPtr createEmpty( |
| 284 | vector_size_t size, |
| 285 | bolt::memory::MemoryPool* pool, |
| 286 | const TypePtr& type) { |
| 287 | using T = typename TypeTraits<kind>::NativeType; |
| 288 | |
| 289 | BufferPtr values; |
| 290 | if constexpr (std::is_same_v<T, StringView>) { |
| 291 | // Make sure to initialize StringView values so they can be safely accessed. |
| 292 | values = AlignedBuffer::allocate<T>(size, pool, T()); |
| 293 | } else { |
| 294 | values = AlignedBuffer::allocate<T>(size, pool); |
| 295 | } |
| 296 | |
| 297 | return std::make_shared<FlatVector<T>>( |
| 298 | pool, |
| 299 | type, |
| 300 | BufferPtr(nullptr), |
| 301 | size, |
| 302 | std::move(values), |
| 303 | std::vector<BufferPtr>()); |
| 304 | } |
| 305 | |
| 306 | // static |
| 307 | VectorPtr BaseVector::createInternal( |
no outgoing calls