aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Processors/Transforms/CubeTransform.h
blob: 54a41e8f44e417f2af73eebabde7f621736b8c9c (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
28
29
30
31
32
#pragma once
#include <Processors/IInflatingTransform.h>
#include <Processors/Transforms/AggregatingTransform.h>
#include <Processors/Transforms/RollupTransform.h>
#include <Processors/Transforms/finalizeChunk.h>


namespace DB
{

/// Takes blocks after grouping, with non-finalized aggregate functions.
/// Calculates all subsets of columns and aggregates over them.
class CubeTransform : public GroupByModifierTransform
{
public:
    CubeTransform(Block header, AggregatingTransformParamsPtr params, bool use_nulls_);
    String getName() const override { return "CubeTransform"; }

protected:
    Chunk generate() override;

private:
    const ColumnsMask aggregates_mask;

    Columns current_columns;
    Columns current_zero_columns;

    UInt64 mask = 0;
    UInt64 grouping_set = 0;
};

}