Skip to content

Commit 996a500

Browse files
authored
[fix](memtable) add check when memtable init aggregate function to avoid core dump (#57934)
### What problem does this PR solve? Sometimes planner will plan error and cause `slot_desc` less than `_num_columns` and cause be core dump, this pr add check when memtable init aggregate function to avoid core dump. ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
1 parent 6da808e commit 996a500

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

be/src/olap/memtable.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ void MemTable::_init_columns_offset_by_slot_descs(const std::vector<SlotDescript
104104
}
105105

106106
void MemTable::_init_agg_functions(const vectorized::Block* block) {
107+
if (_num_columns > _column_offset.size()) [[unlikely]] {
108+
throw std::runtime_error(fmt::format("num_columns {} is greater than block columns {}",
109+
_num_columns, _column_offset.size()));
110+
}
107111
for (auto cid = _tablet_schema->num_key_columns(); cid < _num_columns; ++cid) {
108112
vectorized::AggregateFunctionPtr function;
109113
if (_keys_type == KeysType::UNIQUE_KEYS && _enable_unique_key_mow) {

0 commit comments

Comments
 (0)