| 127 | } |
| 128 | |
| 129 | void TypedColumnBuffer::appendString(std::string_view value) { |
| 130 | assert(storageKindOf(descriptor_.logical_type) == StorageKind::kString); |
| 131 | // Write the initial offset (0) on first row. |
| 132 | if (row_count_ == 0) { |
| 133 | const uint32_t zero = 0; |
| 134 | offsets_.append(&zero, sizeof(zero)); |
| 135 | } |
| 136 | |
| 137 | // Append string bytes to value buffer. |
| 138 | values_.append(value.data(), value.size()); |
| 139 | |
| 140 | // Append new end offset. |
| 141 | const auto end_offset = static_cast<uint32_t>(values_.size()); |
| 142 | offsets_.append(&end_offset, sizeof(end_offset)); |
| 143 | |
| 144 | // Update validity if initialized. |
| 145 | if (validity_initialized_) { |
| 146 | validity_.ensureSize(row_count_ + 1); |
| 147 | validity_.setValid(row_count_); |
| 148 | } |
| 149 | |
| 150 | ++row_count_; |
| 151 | } |
| 152 | |
| 153 | void TypedColumnBuffer::appendNull() { |
| 154 | ensureValidityInitialized(); |