mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
changed sibstring behaviour for offset < -string_lenght [#CLICKHOUSE-2090]
This commit is contained in:
parent
f1c01118b5
commit
5b4759acd9
@ -296,7 +296,7 @@ struct StringSource
|
||||
{
|
||||
size_t elem_size = offsets[row_num] - prev_offset - 1;
|
||||
if (offset > elem_size)
|
||||
return {&elements[prev_offset], elem_size};
|
||||
return {&elements[prev_offset], length + elem_size > offset ? std::min(elem_size, length + elem_size - offset) : 0};
|
||||
return {&elements[prev_offset + elem_size - offset], std::min(length, offset)};
|
||||
}
|
||||
};
|
||||
@ -375,7 +375,7 @@ struct FixedStringSource
|
||||
Slice getSliceFromRight(size_t offset, size_t length) const
|
||||
{
|
||||
if (offset > string_size)
|
||||
return {pos, string_size};
|
||||
return {pos, length + string_size > offset ? std::min(string_size, length + string_size - offset) : 0};
|
||||
return {pos + string_size - offset, std::min(length, offset)};
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user