2023-10-29 23:39:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
2023-11-28 15:32:47 +00:00
|
|
|
#include <Storages/Statistics/Statistics.h>
|
2023-10-29 23:39:16 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/// TDigestStatistic is a kind of histogram.
|
|
|
|
class TDigestStatistic : public IStatistic
|
|
|
|
{
|
|
|
|
QuantileTDigest<Float64> data;
|
|
|
|
public:
|
|
|
|
explicit TDigestStatistic(const StatisticDescription & stat_) : IStatistic(stat_)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Float64 estimateLess(Float64 val) const;
|
|
|
|
|
|
|
|
void serialize(WriteBuffer & buf) override;
|
|
|
|
|
|
|
|
void deserialize(ReadBuffer & buf) override;
|
|
|
|
|
|
|
|
void update(const ColumnPtr & column) override;
|
|
|
|
|
|
|
|
UInt64 count() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|