blob: 791c7d7ba731ce2d9fbb6bf03a7105b085142548 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#pragma once
#include <Processors/Transforms/ExceptionKeepingTransform.h>
#include <Processors/ISimpleTransform.h>
namespace DB
{
class ExpressionActions;
using ExpressionActionsPtr = std::shared_ptr<ExpressionActions>;
class ActionsDAG;
/** Executes a certain expression over the block.
* The expression consists of column identifiers from the block, constants, common functions.
* For example: hits * 2 + 3, url LIKE '%clickhouse%'
* The expression processes each row independently of the others.
*/
class ExpressionTransform final : public ISimpleTransform
{
public:
ExpressionTransform(
const Block & header_,
ExpressionActionsPtr expression_);
String getName() const override { return "ExpressionTransform"; }
static Block transformHeader(Block header, const ActionsDAG & expression);
protected:
void transform(Chunk & chunk) override;
private:
ExpressionActionsPtr expression;
};
class ConvertingTransform final : public ExceptionKeepingTransform
{
public:
ConvertingTransform(
const Block & header_,
ExpressionActionsPtr expression_);
String getName() const override { return "ConvertingTransform"; }
protected:
void onConsume(Chunk chunk) override;
GenerateResult onGenerate() override
{
GenerateResult res;
res.chunk = std::move(cur_chunk);
return res;
}
private:
ExpressionActionsPtr expression;
Chunk cur_chunk;
};
}
|