2023-08-09 20:57:49 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Parsers/IAST_fwd.h>
|
2023-09-26 17:16:01 +00:00
|
|
|
#include <Parsers/ASTColumnDeclaration.h>
|
2023-08-09 20:57:49 +00:00
|
|
|
#include <base/types.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2023-09-08 00:27:17 +00:00
|
|
|
enum StatisticType
|
2023-08-09 20:57:49 +00:00
|
|
|
{
|
2023-09-08 00:27:17 +00:00
|
|
|
TDigest = 0,
|
|
|
|
};
|
2023-08-09 20:57:49 +00:00
|
|
|
|
2023-09-26 17:16:01 +00:00
|
|
|
class ColumnsDescription;
|
|
|
|
|
2023-09-08 00:27:17 +00:00
|
|
|
struct StatisticDescription
|
|
|
|
{
|
2023-09-04 13:51:00 +00:00
|
|
|
/// the type of statistic, right now it's only tdigest.
|
2023-09-08 00:27:17 +00:00
|
|
|
StatisticType type;
|
2023-08-09 20:57:49 +00:00
|
|
|
|
|
|
|
/// Names of statistic columns
|
2023-08-24 12:09:42 +00:00
|
|
|
String column_name;
|
2023-08-09 20:57:49 +00:00
|
|
|
|
2023-09-26 17:16:01 +00:00
|
|
|
ASTPtr ast;
|
|
|
|
|
|
|
|
String getTypeName() const;
|
2023-08-09 20:57:49 +00:00
|
|
|
|
|
|
|
StatisticDescription() = default;
|
|
|
|
|
2023-10-29 23:39:16 +00:00
|
|
|
bool operator==(const StatisticDescription & other) const
|
|
|
|
{
|
|
|
|
return type == other.type && column_name == other.column_name;
|
|
|
|
}
|
|
|
|
|
2023-09-26 17:16:01 +00:00
|
|
|
static StatisticDescription getStatisticFromColumnDeclaration(const ASTColumnDeclaration & column);
|
2023-08-09 20:57:49 +00:00
|
|
|
|
2023-09-26 17:16:01 +00:00
|
|
|
static std::vector<StatisticDescription> getStatisticsFromAST(const ASTPtr & definition_ast, const ColumnsDescription & columns);
|
2023-08-09 20:57:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|