mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-15 12:14:18 +00:00
Merge pull request #70914 from yariks5s/fix_logical_error_substrings
Fix logical error for substrings
This commit is contained in:
commit
bc98110628
@ -62,7 +62,7 @@ struct CountSubstringsImpl
|
||||
while (pos < end && end != (pos = searcher.search(pos, end - pos)))
|
||||
{
|
||||
/// Determine which index it refers to.
|
||||
while (begin + haystack_offsets[i] <= pos)
|
||||
while (i < input_rows_count - 1 && begin + haystack_offsets[i] <= pos)
|
||||
++i;
|
||||
|
||||
auto start = start_pos != nullptr ? start_pos->getUInt(i) : 0;
|
||||
@ -80,9 +80,10 @@ struct CountSubstringsImpl
|
||||
continue;
|
||||
}
|
||||
pos = begin + haystack_offsets[i];
|
||||
++i;
|
||||
|
||||
chassert(i < input_rows_count);
|
||||
++i;
|
||||
if (i >= input_rows_count)
|
||||
break; // Handle the end of the haystacks
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
1150aaa1116
|
@ -0,0 +1,9 @@
|
||||
SELECT
|
||||
concat(concat(11),
|
||||
5,
|
||||
countSubstringsCaseInsensitive(
|
||||
concat(countSubstringsCaseInsensitive(
|
||||
concat(11, toString(number), materialize('aaa111'), 6, materialize(6)), char(number)),
|
||||
'aaa111'),
|
||||
char(countSubstringsCaseInsensitive(concat(' test'), char(toLowCardinality(6))))),
|
||||
'aaa111', 6) FROM numbers(1);
|
Loading…
Reference in New Issue
Block a user