1#pragma once
2
3#include <DataStreams/IBlockInputStream.h>
4
5
6namespace DB
7{
8
9class ExpressionActions;
10
11/** Executes a certain expression over the block.
12 * The expression consists of column identifiers from the block, constants, common functions.
13 * For example: hits * 2 + 3, url LIKE '%yandex%'
14 * The expression processes each row independently of the others.
15 */
16class ExpressionBlockInputStream : public IBlockInputStream
17{
18private:
19 using ExpressionActionsPtr = std::shared_ptr<ExpressionActions>;
20
21public:
22 ExpressionBlockInputStream(const BlockInputStreamPtr & input, const ExpressionActionsPtr & expression_);
23
24 String getName() const override;
25 Block getTotals() override;
26 Block getHeader() const override;
27
28protected:
29 Block readImpl() override;
30
31private:
32 ExpressionActionsPtr expression;
33 Block cached_header;
34 bool initialized = false;
35};
36
37}
38