@@ -9,7 +9,7 @@ namespace NYql {
9
9
class TAggregateExpander {
10
10
public:
11
11
TAggregateExpander (bool usePartitionsByKeys, const bool useFinalizeByKeys, const TExprNode::TPtr& node, TExprContext& ctx, TTypeAnnotationContext& typesCtx,
12
- bool forceCompact = false , bool compactForDistinct = false , bool usePhases = false )
12
+ bool forceCompact = false , bool compactForDistinct = false , bool usePhases = false , bool allowSpilling = false )
13
13
: Node(node)
14
14
, Ctx(ctx)
15
15
, TypesCtx(typesCtx)
@@ -25,6 +25,7 @@ class TAggregateExpander {
25
25
, HaveSessionSetting(false )
26
26
, OriginalRowType(nullptr )
27
27
, RowType(nullptr )
28
+ , UseBlocks(typesCtx.IsBlockEngineEnabled() && !allowSpilling)
28
29
{
29
30
PreMap = Ctx.Builder (node->Pos ())
30
31
.Lambda ()
@@ -115,6 +116,7 @@ class TAggregateExpander {
115
116
const TStructExprType* RowType;
116
117
TVector<const TItemExprType*> RowItems;
117
118
TExprNode::TPtr PreMap;
119
+ bool UseBlocks;
118
120
119
121
TExprNode::TListType InitialColumnNames;
120
122
TExprNode::TListType FinalColumnNames;
@@ -130,8 +132,10 @@ class TAggregateExpander {
130
132
std::unordered_map<std::string_view, TExprNode::TPtr> UdfWasChanged;
131
133
};
132
134
133
- inline TExprNode::TPtr ExpandAggregatePeepholeImpl (const TExprNode::TPtr& node, TExprContext& ctx, TTypeAnnotationContext& typesCtx, const bool useFinalizeByKey, const bool useBlocks) {
134
- TAggregateExpander aggExpander (!useFinalizeByKey && !useBlocks, useFinalizeByKey, node, ctx, typesCtx, true );
135
+ inline TExprNode::TPtr ExpandAggregatePeepholeImpl (const TExprNode::TPtr& node, TExprContext& ctx, TTypeAnnotationContext& typesCtx,
136
+ const bool useFinalizeByKey, const bool useBlocks, const bool allowSpilling) {
137
+ TAggregateExpander aggExpander (!useFinalizeByKey && !useBlocks, useFinalizeByKey, node, ctx, typesCtx,
138
+ true , false , false , allowSpilling);
135
139
return aggExpander.ExpandAggregate ();
136
140
}
137
141
0 commit comments