400275 {
400276 baseptr = handle->Ptr() + segment.GetBlockOffset();
400277
400278
400279 auto header_ptr =
reinterpret_cast<dictionary_compression_header_t *
>(
baseptr);
400280 auto index_buffer_offset = Load<uint32_t>(data_ptr_cast(&header_ptr->index_buffer_offset));
400281 index_buffer_count = Load<uint32_t>(data_ptr_cast(&header_ptr->index_buffer_count));
400282 current_width = (bitpacking_width_t)(Load<uint32_t>(data_ptr_cast(&header_ptr->bitpacking_width)));
400283 if (segment.GetBlockOffset() + index_buffer_offset + sizeof(uint32_t) * index_buffer_count >
400284 segment.GetBlockSize()) {
400285 throw IOException(
400286 "Failed to scan dictionary string - index was out of range. Database file appears to be corrupted.");
400287 }
400288 index_buffer_ptr =
reinterpret_cast<uint32_t *
>(
baseptr + index_buffer_offset);
400290
400291 block_size = segment.GetBlockSize();
400292
400293 dict = DictionaryCompression::GetDictionary(segment, *handle);
400294 if (!initialize_dictionary) {
400295
400296 return;
400297 }
400298
400299 dictionary = DictionaryVector::CreateReusableDictionary(segment.type, index_buffer_count);
400300 dictionary_size = index_buffer_count;
400301 auto dict_child_data = FlatVector::GetData<string_t>(dictionary->data);
400302 FlatVector::SetNull(dictionary->data, 0, true);
400303 for (uint32_t i = 1; i < index_buffer_count; i++) {
400304
400305 uint16_t str_len = GetStringLength(i);
400306 dict_child_data[i] = FetchStringFromDict(UnsafeNumericCast<int32_t>(index_buffer_ptr[i]), str_len);
400307 }
400308}
data_ptr_t base_data
Start of the data (pointing to the start of the selection buffer).
Definition duckdb.cpp:400238
data_ptr_t baseptr
Start of the block (pointing to the dictionary_header).
Definition duckdb.cpp:400236
static constexpr uint16_t DICTIONARY_HEADER_SIZE
Dictionary header size at the beginning of the string segment (offset + length).
Definition duckdb.cpp:399725