Skip to content

Commit

Permalink
Update vendored DuckDB sources to 7f5cc3d
Browse files Browse the repository at this point in the history
  • Loading branch information
duckdblabs-bot committed Feb 11, 2025
1 parent 7f5cc3d commit fa69ecb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/duckdb/extension/parquet/column_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ void ColumnReader::PrepareRead(optional_ptr<const TableFilter> filter) {
if (dictionary_size < 0) {
throw std::runtime_error("Invalid dictionary page header (num_values < 0)");
}
dictionary_decoder.InitializeDictionary(dictionary_size, filter);
dictionary_decoder.InitializeDictionary(dictionary_size, filter, HasDefines());
break;
}
default:
Expand Down
13 changes: 9 additions & 4 deletions src/duckdb/extension/parquet/decoder/dictionary_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ DictionaryDecoder::DictionaryDecoder(ColumnReader &reader)
dictionary_selection_vector(STANDARD_VECTOR_SIZE), dictionary_size(0) {
}

void DictionaryDecoder::InitializeDictionary(idx_t new_dictionary_size, optional_ptr<const TableFilter> filter) {
void DictionaryDecoder::InitializeDictionary(idx_t new_dictionary_size, optional_ptr<const TableFilter> filter,
bool has_defines) {
auto old_dict_size = dictionary_size;
dictionary_size = new_dictionary_size;
filter_result.reset();
filter_count = 0;
can_have_nulls = has_defines;
// we use the first value in the dictionary to keep a NULL
if (!dictionary) {
dictionary = make_uniq<Vector>(reader.type, dictionary_size + 1);
Expand All @@ -27,7 +29,9 @@ void DictionaryDecoder::InitializeDictionary(idx_t new_dictionary_size, optional
// we use the last entry as a NULL, dictionary vectors don't have a separate validity mask
auto &dict_validity = FlatVector::Validity(*dictionary);
dict_validity.Reset(dictionary_size + 1);
dict_validity.SetInvalid(dictionary_size);
if (can_have_nulls) {
dict_validity.SetInvalid(dictionary_size);
}
reader.Plain(reader.block, nullptr, dictionary_size, 0, *dictionary);

if (filter && CanFilter(*filter)) {
Expand Down Expand Up @@ -73,6 +77,7 @@ void DictionaryDecoder::ConvertDictToSelVec(uint32_t *offsets, const SelectionVe
idx_t DictionaryDecoder::GetValidValues(uint8_t *defines, idx_t read_count, idx_t result_offset) {
idx_t valid_count = read_count;
if (defines) {
D_ASSERT(can_have_nulls);
valid_count = 0;
for (idx_t i = 0; i < read_count; i++) {
valid_sel.set_index(valid_count, i);
Expand Down Expand Up @@ -104,10 +109,10 @@ idx_t DictionaryDecoder::Read(uint8_t *defines, idx_t read_count, Vector &result
ConvertDictToSelVec(reinterpret_cast<uint32_t *>(offset_buffer.ptr), valid_sel, valid_count);
}
#ifdef DEBUG
dictionary_selection_vector.Verify(read_count, dictionary_size + 1);
dictionary_selection_vector.Verify(read_count, dictionary_size + can_have_nulls);
#endif
if (result_offset == 0) {
result.Dictionary(*dictionary, dictionary_size + 1, dictionary_selection_vector, read_count);
result.Dictionary(*dictionary, dictionary_size + can_have_nulls, dictionary_selection_vector, read_count);
DictionaryVector::SetDictionaryId(result, dictionary_id);
D_ASSERT(result.GetVectorType() == VectorType::DICTIONARY_VECTOR);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DictionaryDecoder {
explicit DictionaryDecoder(ColumnReader &reader);

public:
void InitializeDictionary(idx_t dictionary_size, optional_ptr<const TableFilter> filter);
void InitializeDictionary(idx_t dictionary_size, optional_ptr<const TableFilter> filter, bool has_defines);
void InitializePage();
idx_t Read(uint8_t *defines, idx_t read_count, Vector &result, idx_t result_offset);
void Skip(uint8_t *defines, idx_t skip_count);
Expand Down Expand Up @@ -48,6 +48,7 @@ class DictionaryDecoder {
unique_ptr<Vector> dictionary;
unsafe_unique_array<bool> filter_result;
idx_t filter_count;
bool can_have_nulls;
string dictionary_id;
};

Expand Down
6 changes: 3 additions & 3 deletions src/duckdb/src/function/table/version/pragma_version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DUCKDB_PATCH_VERSION
#define DUCKDB_PATCH_VERSION "1-dev152"
#define DUCKDB_PATCH_VERSION "1-dev163"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 2
Expand All @@ -8,10 +8,10 @@
#define DUCKDB_MAJOR_VERSION 1
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v1.2.1-dev152"
#define DUCKDB_VERSION "v1.2.1-dev163"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "83d07cb683"
#define DUCKDB_SOURCE_ID "f317a112e0"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down

0 comments on commit fa69ecb

Please sign in to comment.