This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 996a5002076 [fix](memtable) add check when memtable init aggregate 
function to avoid core dump (#57934)
996a5002076 is described below

commit 996a5002076738c47afe982cdcfc39df38060e2b
Author: hui lai <[email protected]>
AuthorDate: Thu Nov 13 02:54:09 2025 +0800

    [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:
    https://github.com/apache/doris-website/pull/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 -->
---
 be/src/olap/memtable.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/be/src/olap/memtable.cpp b/be/src/olap/memtable.cpp
index 8a6cb67f714..03a97d876c7 100644
--- a/be/src/olap/memtable.cpp
+++ b/be/src/olap/memtable.cpp
@@ -104,6 +104,10 @@ void MemTable::_init_columns_offset_by_slot_descs(const 
std::vector<SlotDescript
 }
 
 void MemTable::_init_agg_functions(const vectorized::Block* block) {
+    if (_num_columns > _column_offset.size()) [[unlikely]] {
+        throw std::runtime_error(fmt::format("num_columns {} is greater than 
block columns {}",
+                                             _num_columns, 
_column_offset.size()));
+    }
     for (auto cid = _tablet_schema->num_key_columns(); cid < _num_columns; 
++cid) {
         vectorized::AggregateFunctionPtr function;
         if (_keys_type == KeysType::UNIQUE_KEYS && _enable_unique_key_mow) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to