Skip to content

Commit 0433d9c

Browse files
Merge pull request #10870 from azat/fix-SIGSEGV-in-hash-table-for-string
Fix SIGSEGV in StringHashTable (if such key does not exist)
2 parents efa1e95 + 6e11c8a commit 0433d9c

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/Common/HashTable/StringHashTable.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,11 @@ class StringHashTable : private boost::noncopyable
333333
template <typename Submap, typename SubmapKey>
334334
auto ALWAYS_INLINE operator()(Submap & map, const SubmapKey & key, size_t hash)
335335
{
336-
return &map.find(key, hash)->getMapped();
336+
auto it = map.find(key, hash);
337+
if (!it)
338+
return decltype(&it->getMapped()){};
339+
else
340+
return &it->getMapped();
337341
}
338342
};
339343

tests/queries/0_stateless/01279_dist_group_by.reference

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
drop table if exists data_01279;
2+
3+
create table data_01279 (key String) Engine=TinyLog();
4+
insert into data_01279 select reinterpretAsString(number) from numbers(100000);
5+
6+
set max_rows_to_group_by=10;
7+
set group_by_overflow_mode='any';
8+
set group_by_two_level_threshold=100;
9+
select * from data_01279 group by key format Null;

0 commit comments

Comments
 (0)