-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Bug](array) fix array column core dump in get_shrinked_column as not check type #33295
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -120,6 +120,7 @@ class ColumnString final : public COWHelper<IColumn, ColumnString> { | |||||
| MutableColumnPtr clone_resized(size_t to_size) const override; | ||||||
|
|
||||||
| MutableColumnPtr get_shrinked_column() override; | ||||||
| bool could_shrinked_column() override { return true; } | ||||||
|
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. warning: method 'could_shrinked_column' can be made static [readability-convert-member-functions-to-static]
Suggested change
|
||||||
|
|
||||||
| Field operator[](size_t n) const override { | ||||||
| assert(n < size()); | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -295,13 +295,22 @@ ColumnPtr ColumnStruct::replicate(const Offsets& offsets) const { | |
| return ColumnStruct::create(new_columns); | ||
| } | ||
|
|
||
| bool ColumnStruct::could_shrinked_column() { | ||
|
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. warning: method 'could_shrinked_column' can be made static [readability-convert-member-functions-to-static] be/src/vec/columns/column_struct.h:158: - bool could_shrinked_column() override;
+ static bool could_shrinked_column() override; |
||
| const size_t tuple_size = columns.size(); | ||
| for (size_t i = 0; i < tuple_size; ++i) { | ||
| if (columns[i]->could_shrinked_column()) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| MutableColumnPtr ColumnStruct::get_shrinked_column() { | ||
| const size_t tuple_size = columns.size(); | ||
| MutableColumns new_columns(tuple_size); | ||
|
|
||
| for (size_t i = 0; i < tuple_size; ++i) { | ||
| if (columns[i]->is_column_string() || columns[i]->is_column_array() || | ||
| columns[i]->is_column_map() || columns[i]->is_column_struct()) { | ||
| if (columns[i]->could_shrinked_column()) { | ||
| new_columns[i] = columns[i]->get_shrinked_column(); | ||
| } else { | ||
| new_columns[i] = columns[i]->get_ptr(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,6 @@ | |
| -- !select -- | ||
| 100 [["abc"]] | ||
|
|
||
| -- !select_2 -- | ||
| a {"codes": [123, 456], "props": {"key1":["char1", "char2"]}} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: method 'get_family_name' can be made static [readability-convert-member-functions-to-static]