| 1 | #pragma once |
| 2 | |
| 3 | #include <DataStreams/IBlockInputStream.h> |
| 4 | |
| 5 | |
| 6 | namespace DB |
| 7 | { |
| 8 | |
| 9 | class 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 | */ |
| 16 | class ExpressionBlockInputStream : public IBlockInputStream |
| 17 | { |
| 18 | private: |
| 19 | using ExpressionActionsPtr = std::shared_ptr<ExpressionActions>; |
| 20 | |
| 21 | public: |
| 22 | ExpressionBlockInputStream(const BlockInputStreamPtr & input, const ExpressionActionsPtr & expression_); |
| 23 | |
| 24 | String getName() const override; |
| 25 | Block getTotals() override; |
| 26 | Block () const override; |
| 27 | |
| 28 | protected: |
| 29 | Block readImpl() override; |
| 30 | |
| 31 | private: |
| 32 | ExpressionActionsPtr expression; |
| 33 | Block ; |
| 34 | bool initialized = false; |
| 35 | }; |
| 36 | |
| 37 | } |
| 38 | |