| 119 | |
| 120 | template <> |
| 121 | void FlatVector<StringView>::prepareForReuse() { |
| 122 | BaseVector::prepareForReuse(); |
| 123 | |
| 124 | // Check values buffer. Keep the buffer if singly-referenced and mutable. |
| 125 | // Reset otherwise. |
| 126 | if (values_ && !values_->isMutable()) { |
| 127 | values_ = nullptr; |
| 128 | rawValues_ = nullptr; |
| 129 | } |
| 130 | |
| 131 | keepAtMostOneStringBuffer(); |
| 132 | |
| 133 | // Clear the StringViews to avoid referencing freed memory. |
| 134 | if (rawValues_) { |
| 135 | for (auto i = 0; i < BaseVector::length_; ++i) { |
| 136 | rawValues_[i] = StringView(); |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | // Reset string stats since the vector is being reused with new data. |
| 141 | stringStats_.reset(); |
| 142 | } |
| 143 | |
| 144 | template <> |
| 145 | void FlatVector<StringView>::set(vector_size_t idx, StringView value) { |
nothing calls this directly
no test coverage detected