mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 09:02:00 +00:00
Fixed function toStringCutToZero with argument of type String [#CLICKHOUSE-2958].
This commit is contained in:
parent
b51c6e7592
commit
f76680d47e
@ -1759,16 +1759,19 @@ public:
|
|||||||
|
|
||||||
char * begin = reinterpret_cast<char *>(&out_vec[0]);
|
char * begin = reinterpret_cast<char *>(&out_vec[0]);
|
||||||
char * pos = begin;
|
char * pos = begin;
|
||||||
const char * pos_in = reinterpret_cast<const char *>(&in_vec[0]);
|
|
||||||
|
ColumnString::Offset_t current_in_offset = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < size; ++i)
|
for (size_t i = 0; i < size; ++i)
|
||||||
{
|
{
|
||||||
|
const char * pos_in = reinterpret_cast<const char *>(&in_vec[current_in_offset]);
|
||||||
size_t current_size = strlen(pos_in);
|
size_t current_size = strlen(pos_in);
|
||||||
memcpySmallAllowReadWriteOverflow15(pos, pos_in, current_size);
|
memcpySmallAllowReadWriteOverflow15(pos, pos_in, current_size);
|
||||||
pos += current_size;
|
pos += current_size;
|
||||||
*pos = '\0';
|
*pos = '\0';
|
||||||
out_offsets[i] = ++pos - begin;
|
++pos;
|
||||||
pos_in += in_offsets[i];
|
out_offsets[i] = pos - begin;
|
||||||
|
current_in_offset = in_offsets[i];
|
||||||
}
|
}
|
||||||
out_vec.resize(pos - begin);
|
out_vec.resize(pos - begin);
|
||||||
|
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
1
|
||||||
|
1
|
@ -0,0 +1,2 @@
|
|||||||
|
SELECT DISTINCT toString(number) = toStringCutToZero(toString(number)) FROM (SELECT * FROM system.numbers LIMIT 1000);
|
||||||
|
SELECT DISTINCT toString(number) = toStringCutToZero(toFixedString(toString(number), 10)) FROM (SELECT * FROM system.numbers LIMIT 1000);
|
Loading…
Reference in New Issue
Block a user