MCPcopy Create free account
hub / github.com/bytedance/bolt / clear

Method clear

bolt/serializers/PrestoSerializer.cpp:1589–1610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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_;

Callers 2

serializeWrappedFunction · 0.45
clearMethod · 0.45

Calls 4

typeToEncodingNameFunction · 0.70
startWriteMethod · 0.45
sizeMethod · 0.45
kindMethod · 0.45

Tested by

no test coverage detected