| 151 | } |
| 152 | |
| 153 | void TypedColumnBuffer::appendNull() { |
| 154 | ensureValidityInitialized(); |
| 155 | |
| 156 | // Ensure bitmap has room for this row. |
| 157 | validity_.ensureSize(row_count_ + 1); |
| 158 | validity_.setNull(row_count_); |
| 159 | |
| 160 | // Append zero bytes for the value slot. |
| 161 | const StorageKind kind = storageKindOf(descriptor_.logical_type); |
| 162 | if (kind == StorageKind::kString) { |
| 163 | // For strings: write the initial offset if this is the first row. |
| 164 | if (row_count_ == 0) { |
| 165 | const uint32_t zero = 0; |
| 166 | offsets_.append(&zero, sizeof(zero)); |
| 167 | } |
| 168 | // Duplicate the current end offset (no new string data). |
| 169 | const auto current_offset = static_cast<uint32_t>(values_.size()); |
| 170 | offsets_.append(¤t_offset, sizeof(current_offset)); |
| 171 | } else { |
| 172 | const std::size_t type_size = storageKindSize(kind); |
| 173 | // Append type_size zero bytes. |
| 174 | const uint64_t zero = 0; // 8 bytes, enough for any fixed type |
| 175 | values_.append(&zero, type_size); |
| 176 | } |
| 177 | |
| 178 | ++row_count_; |
| 179 | ++null_count_; |
| 180 | } |
| 181 | |
| 182 | // --------------------------------------------------------------------------- |
| 183 | // Bulk fixed-size append template |