Skip to content

Commit

Permalink
[Fix](parquet-reader) Fix parquet reader crash in set_dict(). (#41307)
Browse files Browse the repository at this point in the history
## Proposed changes

Backport #40643
  • Loading branch information
kaka11chen authored Sep 26, 2024
1 parent 9ae7165 commit 2292a69
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions be/src/vec/exec/format/parquet/byte_array_dict_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ namespace doris::vectorized {
Status ByteArrayDictDecoder::set_dict(std::unique_ptr<uint8_t[]>& dict, int32_t length,
size_t num_values) {
_dict = std::move(dict);
if (_dict == nullptr) {
return Status::Corruption("Wrong dictionary data for byte array type, dict is null.");
}
_dict_items.reserve(num_values);
uint32_t offset_cursor = 0;
char* dict_item_address = reinterpret_cast<char*>(_dict.get());
Expand Down
3 changes: 3 additions & 0 deletions be/src/vec/exec/format/parquet/fix_length_dict_decoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ class FixLengthDictDecoder final : public BaseDictDecoder {
return Status::Corruption("Wrong dictionary data for fixed length type");
}
_dict = std::move(dict);
if (_dict == nullptr) {
return Status::Corruption("Wrong dictionary data for byte array type, dict is null.");
}
char* dict_item_address = reinterpret_cast<char*>(_dict.get());
_dict_items.resize(num_values);
_dict_value_to_code.reserve(num_values);
Expand Down

0 comments on commit 2292a69

Please sign in to comment.