mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Fix error in "extractAllGroups" function
This commit is contained in:
parent
4a094491f2
commit
c37b55c3b1
@ -129,7 +129,9 @@ public:
|
||||
for (size_t group = 1; group <= groups_count; ++group)
|
||||
data_col->insertData(matched_groups[group].data(), matched_groups[group].size());
|
||||
|
||||
pos = matched_groups[0].data() + matched_groups[0].size();
|
||||
/// If match is empty - it's technically Ok but we have to shift one character nevertheless
|
||||
/// to avoid infinite loop.
|
||||
pos = matched_groups[0].data() + std::max<size_t>(1, matched_groups[0].size());
|
||||
|
||||
current_nested_offset += groups_count;
|
||||
nested_offsets_data.push_back(current_nested_offset);
|
||||
@ -167,7 +169,7 @@ public:
|
||||
for (size_t group = 1; group <= groups_count; ++group)
|
||||
all_matches.push_back(matched_groups[group]);
|
||||
|
||||
pos = matched_groups[0].data() + matched_groups[0].size();
|
||||
pos = matched_groups[0].data() + std::max<size_t>(1, matched_groups[0].size());
|
||||
|
||||
++matches_per_row;
|
||||
}
|
||||
|
@ -0,0 +1,2 @@
|
||||
[[''],[''],[''],[''],[''],[''],['']]
|
||||
[['','','','','','','']]
|
@ -0,0 +1,2 @@
|
||||
SELECT extractAllGroupsVertical('@#$%^&*', '(\w*)');
|
||||
SELECT extractAllGroupsHorizontal('@#$%^&*', '(\w*)');
|
Loading…
Reference in New Issue
Block a user