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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#pragma once
#include <yql/essentials/core/yql_graph_transformer.h>
namespace NYql {
namespace NPureCalc {
/**
* A transformer which wraps the given input node with the pipeline
* converting the input type to the block one.
*
* @param pos the position of the given node to be rewritten.
* @param structType the item type of the container provided by the node.
* @param ctx the context to make ExprNode rewrites.
* @return the resulting ExprNode.
*/
TExprNode::TPtr NodeFromBlocks(
const TPositionHandle& pos,
const TStructExprType* structType,
TExprContext& ctx
);
/**
* A transformer which wraps the given root node with the pipeline
* converting the output type to the block one.
*
* @param pos the position of the given node to be rewritten.
* @param structType the item type of the container provided by the node.
* @param ctx the context to make ExprNode rewrites.
* @return the resulting ExprNode.
*/
TExprNode::TPtr NodeToBlocks(
const TPositionHandle& pos,
const TStructExprType* structType,
TExprContext& ctx
);
/**
* A transformer to apply the given lambda to the given iterable (either
* list or stream). If the iterable is list, the lambda should be passed
* to the <LMap> callable; if the iterable is stream, the lambda should
* be applied right to the iterable.
*
* @param pos the position of the given node to be rewritten.
* @param iterable the node, that provides the iterable to be processed.
* @param lambda the node, that provides lambda to be applied.
* @param wrapLMap indicator to wrap the result with LMap callable.
* @oaram ctx the context to make ExprNode rewrites.
*/
TExprNode::TPtr ApplyToIterable(
const TPositionHandle& pos,
const TExprNode::TPtr iterable,
const TExprNode::TPtr lambda,
bool wrapLMap,
TExprContext& ctx
);
/**
* A helper which wraps the items of the given struct with the block
* type container and appends the new item for _yql_block_length column.
*
* @param structType original struct to be wrapped.
* @param ctx the context to make ExprType rewrite.
* @return the new struct with block items.
*/
const TStructExprType* WrapBlockStruct(
const TStructExprType* structType,
TExprContext& ctx
);
/**
* A helper which unwraps the block container from the items of the
* given struct and removes the item for _yql_block_length column.
*
* @param structType original struct to be unwrapped.
* @param ctx the context to make ExprType rewrite.
* @return the new struct without block items.
*/
const TStructExprType* UnwrapBlockStruct(
const TStructExprType* structType,
TExprContext& ctx
);
}
}
|