blob: a92b77b1115c30be56ded39d509bfddd79e9beaf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#pragma once
#include <Analyzer/IQueryTreePass.h>
namespace DB
{
/*
* This pass replaces several calls of aggregate functions of the same family into one call.
* Result will be calculated only once because of CSE.
*
* Replaces:
* `sum(x), count(x), avg(x)` with `sumCount(x).1, sumCount(x).2, sumCount(x).1 / toFloat64(sumCount(x).2)`
* `quantile(0.5)(x), quantile(0.9)(x)` with `quantiles(0.5, 0.9)(x)[1], quantiles(0.5, 0.9)(x)[2]`
*/
class FuseFunctionsPass final : public IQueryTreePass
{
public:
String getName() override { return "FuseFunctionsPass"; }
String getDescription() override { return "Replaces several calls of aggregate functions of the same family into one call"; }
void run(QueryTreeNodePtr query_tree_node, ContextPtr context) override;
};
}
|