Skip to content

Commit b2d1685

Browse files
authored
[Fix](memtable) fix shrink_memtable_by_agg without duplicated keys (#28660)
remove duplicated logic: ``` vectorized::Block in_block = _input_mutable_block.to_block(); _put_into_output(in_block); ``` `_input_mutable_block.to_block()` will move `_input_mutable_block`, and lead to `flush` with empty block
1 parent d2275e7 commit b2d1685

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

‎be/src/olap/memtable.cpp‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,7 @@ void MemTable::shrink_memtable_by_agg() {
468468
return;
469469
}
470470
size_t same_keys_num = _sort();
471-
if (same_keys_num == 0) {
472-
vectorized::Block in_block = _input_mutable_block.to_block();
473-
_put_into_output(in_block);
474-
} else {
471+
if (same_keys_num != 0) {
475472
_aggregate<false>();
476473
}
477474
}

‎regression-test/suites/load_p0/insert/test_insert_with_aggregation_memtable.groovy‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ suite("test_insert_with_aggregation_memtable", "nonConcurrent") {
132132
sql """INSERT INTO ${table_name} SELECT k, v from ${table_name}"""
133133
createMV("""create materialized view var_cnt as select k, count(k) from ${table_name} group by k""")
134134
sql """INSERT INTO ${table_name} SELECT k, v from ${table_name} limit 8101"""
135+
// insert with no duplicate
136+
sql """INSERT INTO ${table_name} SELECT *, '{"k1":1, "k2": "hello world", "k3" : [1234], "k4" : 1.10000, "k5" : [[123]]}' FROM numbers("number" = "4096"); """
135137

136138
reset_be_param("enable_shrink_memory")
137139
reset_be_param("write_buffer_size_for_agg")

0 commit comments

Comments
 (0)