2018-08-21 16:08:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-01-23 14:48:50 +00:00
|
|
|
#include <DataStreams/IBlockInputStream.h>
|
2018-08-21 16:08:45 +00:00
|
|
|
#include <Interpreters/Aggregator.h>
|
2018-09-05 14:39:51 +00:00
|
|
|
#include <Core/ColumnNumbers.h>
|
2018-08-21 16:08:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class ExpressionActions;
|
|
|
|
|
|
|
|
|
|
|
|
/** Takes blocks after grouping, with non-finalized aggregate functions.
|
2018-08-27 09:09:47 +00:00
|
|
|
* Calculates subtotals and grand totals values for a set of columns.
|
2018-08-21 16:08:45 +00:00
|
|
|
*/
|
2019-01-23 14:48:50 +00:00
|
|
|
class RollupBlockInputStream : public IBlockInputStream
|
2018-08-21 16:08:45 +00:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
using ExpressionActionsPtr = std::shared_ptr<ExpressionActions>;
|
|
|
|
using AggregateColumns = std::vector<ColumnRawPtrs>;
|
|
|
|
public:
|
|
|
|
RollupBlockInputStream(
|
|
|
|
const BlockInputStreamPtr & input_, const Aggregator::Params & params_);
|
|
|
|
|
|
|
|
String getName() const override { return "Rollup"; }
|
|
|
|
|
|
|
|
Block getHeader() const override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Block readImpl() override;
|
|
|
|
|
|
|
|
private:
|
2018-09-05 14:39:51 +00:00
|
|
|
Aggregator aggregator;
|
|
|
|
ColumnNumbers keys;
|
|
|
|
ssize_t current_key = -1;
|
|
|
|
Block rollup_block;
|
2018-08-21 16:08:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|