| 1587 | } |
| 1588 | |
| 1589 | void clear() { |
| 1590 | encoding_ = std::nullopt; |
| 1591 | initializeHeader(typeToEncodingName(type_), *streamArena_); |
| 1592 | nonNullCount_ = 0; |
| 1593 | nullCount_ = 0; |
| 1594 | totalLength_ = 0; |
| 1595 | if (hasLengths_) { |
| 1596 | lengths_.startWrite(lengths_.size()); |
| 1597 | if (type_->kind() == TypeKind::ROW || type_->kind() == TypeKind::ARRAY || |
| 1598 | type_->kind() == TypeKind::MAP) { |
| 1599 | // The first element in the offsets in the wire format is always 0 for |
| 1600 | // nested types. Set upon construction/reset in case empty (no append |
| 1601 | // calls will be made). |
| 1602 | lengths_.appendOne<int32_t>(0); |
| 1603 | } |
| 1604 | } |
| 1605 | nulls_.startWrite(nulls_.size()); |
| 1606 | values_.startWrite(values_.size()); |
| 1607 | for (auto& child : children_) { |
| 1608 | child->clear(); |
| 1609 | } |
| 1610 | } |
| 1611 | |
| 1612 | private: |
| 1613 | const TypePtr type_; |
no test coverage detected