-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](storage) low_cardinality_optimize core dump when is null predicate #9586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,12 +98,10 @@ class ColumnDictionary final : public COWHelper<IColumn, ColumnDictionary<T>> { | |
| } | ||
|
|
||
| void insert_data(const char* pos, size_t /*length*/) override { | ||
| _codes.push_back(unaligned_load<T>(pos)); | ||
| LOG(FATAL) << "insert_data not supported in ColumnDictionary"; | ||
| } | ||
|
|
||
| void insert_data(const T value) { _codes.push_back(value); } | ||
|
|
||
| void insert_default() override { _codes.push_back(T()); } | ||
| void insert_default() override { _codes.push_back(_dict.get_null_code()); } | ||
|
|
||
| void clear() override { | ||
| _codes.clear(); | ||
|
|
@@ -219,13 +217,12 @@ class ColumnDictionary final : public COWHelper<IColumn, ColumnDictionary<T>> { | |
| void insert_many_dict_data(const int32_t* data_array, size_t start_index, | ||
| const StringRef* dict_array, size_t data_num, | ||
| uint32_t dict_num) override { | ||
| if (!is_dict_inited()) { | ||
| if (_dict.empty()) { | ||
| _dict.reserve(dict_num); | ||
| for (uint32_t i = 0; i < dict_num; ++i) { | ||
| auto value = StringValue(dict_array[i].data, dict_array[i].size); | ||
| _dict.insert_value(value); | ||
| } | ||
| _dict_inited = true; | ||
| } | ||
|
|
||
| char* end_ptr = (char*)_codes.get_end_ptr(); | ||
|
|
@@ -263,8 +260,6 @@ class ColumnDictionary final : public COWHelper<IColumn, ColumnDictionary<T>> { | |
| return _dict.find_codes(values); | ||
| } | ||
|
|
||
| bool is_dict_inited() const { return _dict_inited; } | ||
|
|
||
| bool is_dict_sorted() const { return _dict_sorted; } | ||
|
|
||
| bool is_dict_code_converted() const { return _dict_code_converted; } | ||
|
|
@@ -301,13 +296,17 @@ class ColumnDictionary final : public COWHelper<IColumn, ColumnDictionary<T>> { | |
| if (it != _inverted_index.end()) { | ||
| return it->second; | ||
| } | ||
| return -1; | ||
| return -2; // -1 is null code | ||
| } | ||
|
|
||
| inline StringValue& get_value(T code) { return _dict_data[code]; } | ||
| T get_null_code() { return -1; } | ||
|
|
||
| inline StringValue& get_value(T code) { | ||
| return code >= _dict_data.size() ? _null_value : _dict_data[code]; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, this does not work now? |
||
|
|
||
| inline void generate_hash_values() { | ||
| if (_hash_values.size() == 0) { | ||
| if (_hash_values.empty()) { | ||
| _hash_values.resize(_dict_data.size()); | ||
| for (size_t i = 0; i < _dict_data.size(); i++) { | ||
| auto& sv = _dict_data[i]; | ||
|
|
@@ -380,7 +379,10 @@ class ColumnDictionary final : public COWHelper<IColumn, ColumnDictionary<T>> { | |
|
|
||
| size_t byte_size() { return _dict_data.size() * sizeof(_dict_data[0]); } | ||
|
|
||
| bool empty() { return _dict_data.empty(); } | ||
|
|
||
| private: | ||
| StringValue _null_value = StringValue(); | ||
| StringValue::Comparator _comparator; | ||
| // dict code -> dict value | ||
| DictContainer _dict_data; | ||
|
|
@@ -398,16 +400,12 @@ class ColumnDictionary final : public COWHelper<IColumn, ColumnDictionary<T>> { | |
|
|
||
| private: | ||
| size_t _reserve_size; | ||
| bool _dict_inited = false; | ||
| bool _dict_sorted = false; | ||
| bool _dict_code_converted = false; | ||
| Dictionary _dict; | ||
| Container _codes; | ||
| }; | ||
|
|
||
| template class ColumnDictionary<uint8_t>; | ||
| template class ColumnDictionary<uint16_t>; | ||
| template class ColumnDictionary<uint32_t>; | ||
| template class ColumnDictionary<int32_t>; | ||
|
|
||
| using ColumnDictI32 = vectorized::ColumnDictionary<doris::vectorized::Int32>; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.