mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #16865 from filimonov/timeSeriesGroupSum-segfault
Fix for issue #16862
This commit is contained in:
commit
2151365764
@ -187,7 +187,10 @@ struct AggregateFunctionTimeSeriesGroupSumData
|
||||
{
|
||||
size_t size = result.size();
|
||||
writeVarUInt(size, buf);
|
||||
buf.write(reinterpret_cast<const char *>(result.data()), sizeof(result[0]));
|
||||
if (size > 0)
|
||||
{
|
||||
buf.write(reinterpret_cast<const char *>(result.data()), size * sizeof(result[0]));
|
||||
}
|
||||
}
|
||||
|
||||
void deserialize(ReadBuffer & buf)
|
||||
@ -195,8 +198,11 @@ struct AggregateFunctionTimeSeriesGroupSumData
|
||||
size_t size = 0;
|
||||
readVarUInt(size, buf);
|
||||
result.resize(size);
|
||||
if (size > 0)
|
||||
{
|
||||
buf.read(reinterpret_cast<char *>(result.data()), size * sizeof(result[0]));
|
||||
}
|
||||
}
|
||||
};
|
||||
template <bool rate>
|
||||
class AggregateFunctionTimeSeriesGroupSum final
|
||||
|
@ -0,0 +1,3 @@
|
||||
[]
|
||||
1
|
||||
server is still alive
|
@ -0,0 +1,23 @@
|
||||
DROP TABLE IF EXISTS tsgs_local;
|
||||
DROP TABLE IF EXISTS tsgs;
|
||||
|
||||
CREATE TABLE tsgs_local ENGINE = MergeTree ORDER BY tuple() AS
|
||||
SELECT
|
||||
toUInt64(13820745146630357293) AS a,
|
||||
toInt64(1604422500000000000) AS b,
|
||||
toFloat64(0) AS c
|
||||
FROM numbers(100);
|
||||
|
||||
-- the issue (https://github.com/ClickHouse/ClickHouse/issues/16862) happens during serialization of the state
|
||||
-- so happens only when Distributed tables are used or with -State modifier.
|
||||
|
||||
CREATE TABLE tsgs AS tsgs_local ENGINE = Distributed(test_cluster_two_shards, currentDatabase(), tsgs_local);
|
||||
|
||||
SELECT timeSeriesGroupSum(a, b, c) FROM tsgs;
|
||||
|
||||
SELECT count() FROM ( SELECT timeSeriesGroupSumState(a, b, c) as x FROM tsgs_local) WHERE NOT ignore(*);
|
||||
|
||||
SELECT 'server is still alive';
|
||||
|
||||
DROP TABLE tsgs_local;
|
||||
DROP TABLE tsgs;
|
Loading…
Reference in New Issue
Block a user