mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge f158c0346c
into 44b4bd38b9
This commit is contained in:
commit
1860d6bbf0
@ -370,10 +370,14 @@ struct PositionImpl
|
|||||||
{
|
{
|
||||||
size_t needle_size = needle_offsets[i] - prev_needle_offset - 1;
|
size_t needle_size = needle_offsets[i] - prev_needle_offset - 1;
|
||||||
size_t haystack_size = haystack_offsets[i] - prev_haystack_offset - 1;
|
size_t haystack_size = haystack_offsets[i] - prev_haystack_offset - 1;
|
||||||
|
|
||||||
|
size_t haystack_chars_size = Impl::countChars(
|
||||||
|
reinterpret_cast<const char *>(&haystack_data[prev_haystack_offset]),
|
||||||
|
reinterpret_cast<const char *>(&haystack_data[haystack_offsets[i] - 1]));
|
||||||
|
|
||||||
auto start = start_pos != nullptr ? std::max(start_pos->getUInt(i), UInt64(1)) : UInt64(1);
|
auto start = start_pos != nullptr ? std::max(start_pos->getUInt(i), UInt64(1)) : UInt64(1);
|
||||||
|
|
||||||
if (start > haystack_size + 1)
|
if (start > haystack_chars_size + 1)
|
||||||
{
|
{
|
||||||
res[i] = 0;
|
res[i] = 0;
|
||||||
}
|
}
|
||||||
@ -429,13 +433,15 @@ struct PositionImpl
|
|||||||
/// NOTE You could use haystack indexing. But this is a rare case.
|
/// NOTE You could use haystack indexing. But this is a rare case.
|
||||||
ColumnString::Offset prev_needle_offset = 0;
|
ColumnString::Offset prev_needle_offset = 0;
|
||||||
|
|
||||||
|
size_t haystack_size = Impl::countChars(haystack.data(), haystack.data() + haystack.size());
|
||||||
|
|
||||||
for (size_t i = 0; i < input_rows_count; ++i)
|
for (size_t i = 0; i < input_rows_count; ++i)
|
||||||
{
|
{
|
||||||
size_t needle_size = needle_offsets[i] - prev_needle_offset - 1;
|
size_t needle_size = needle_offsets[i] - prev_needle_offset - 1;
|
||||||
|
|
||||||
auto start = start_pos != nullptr ? std::max(start_pos->getUInt(i), UInt64(1)) : UInt64(1);
|
auto start = start_pos != nullptr ? std::max(start_pos->getUInt(i), UInt64(1)) : UInt64(1);
|
||||||
|
|
||||||
if (start > haystack.size() + 1)
|
if (start > haystack_size + 1)
|
||||||
{
|
{
|
||||||
res[i] = 0;
|
res[i] = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user