| 284 | }; |
| 285 | |
| 286 | void ComputeDataPreallocate(const DataType& type, |
| 287 | std::vector<BufferPreallocation>* widths) { |
| 288 | if (is_fixed_width(type.id()) && type.id() != Type::NA) { |
| 289 | widths->emplace_back(checked_cast<const FixedWidthType&>(type).bit_width()); |
| 290 | return; |
| 291 | } |
| 292 | // Preallocate binary and list offsets |
| 293 | switch (type.id()) { |
| 294 | case Type::BINARY: |
| 295 | case Type::STRING: |
| 296 | case Type::LIST: |
| 297 | case Type::MAP: |
| 298 | widths->emplace_back(32, /*added_length=*/1); |
| 299 | return; |
| 300 | case Type::LARGE_BINARY: |
| 301 | case Type::LARGE_STRING: |
| 302 | case Type::LARGE_LIST: |
| 303 | widths->emplace_back(64, /*added_length=*/1); |
| 304 | return; |
| 305 | default: |
| 306 | break; |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | } // namespace |
| 311 |
no test coverage detected