@@ -61,11 +61,10 @@ Y_UNIT_TEST_SUITE(TYqlCBO) {
61
61
62
62
Y_UNIT_TEST (OrderJoinsDoesNothingWhenCBODisabled) {
63
63
const TString cluster (" ut_cluster" );
64
- TYtState::TPtr state = MakeIntrusive<TYtState>();
64
+ TTypeAnnotationContext typeCtx;
65
+ TYtState::TPtr state = MakeIntrusive<TYtState>(&typeCtx);
65
66
TYtJoinNodeOp::TPtr tree = nullptr ;
66
67
TYtJoinNodeOp::TPtr optimizedTree;
67
- TTypeAnnotationContext typeCtx;
68
- state->Types = &typeCtx;
69
68
70
69
TExprContext ctx;
71
70
@@ -100,7 +99,8 @@ Y_UNIT_TEST(NonReordable) {
100
99
101
100
Y_UNIT_TEST (BuildOptimizerTree2Tables) {
102
101
const TString cluster (" ut_cluster" );
103
- TYtState::TPtr state = MakeIntrusive<TYtState>();
102
+ TTypeAnnotationContext typeCtx;
103
+ TYtState::TPtr state = MakeIntrusive<TYtState>(&typeCtx);
104
104
TExprContext exprCtx;
105
105
auto tree = MakeOp ({" c" , " c_nationkey" }, {" n" , " n_nationkey" }, {" c" , " n" }, exprCtx);
106
106
tree->Left = MakeLeaf ({" c" }, {" c" }, 100000 , 12333 , exprCtx);
@@ -127,7 +127,8 @@ Y_UNIT_TEST(BuildOptimizerTree2Tables) {
127
127
128
128
Y_UNIT_TEST (BuildOptimizerTree2TablesComplexLabel) {
129
129
const TString cluster (" ut_cluster" );
130
- TYtState::TPtr state = MakeIntrusive<TYtState>();
130
+ TTypeAnnotationContext typeCtx;
131
+ TYtState::TPtr state = MakeIntrusive<TYtState>(&typeCtx);
131
132
TExprContext exprCtx;
132
133
auto tree = MakeOp ({" c" , " c_nationkey" }, {" n" , " n_nationkey" }, {" c" , " n" , " e" }, exprCtx);
133
134
tree->Left = MakeLeaf ({" c" }, {" c" }, 1000000 , 1233333 , exprCtx);
@@ -154,7 +155,8 @@ Y_UNIT_TEST(BuildOptimizerTree2TablesComplexLabel) {
154
155
155
156
Y_UNIT_TEST (BuildYtJoinTree2Tables) {
156
157
const TString cluster (" ut_cluster" );
157
- TYtState::TPtr state = MakeIntrusive<TYtState>();
158
+ TTypeAnnotationContext typeCtx;
159
+ TYtState::TPtr state = MakeIntrusive<TYtState>(&typeCtx);
158
160
TExprContext exprCtx;
159
161
auto tree = MakeOp ({" c" , " c_nationkey" }, {" n" , " n_nationkey" }, {" c" , " n" }, exprCtx);
160
162
tree->Left = MakeLeaf ({" c" }, {" c" }, 100000 , 12333 , exprCtx);
@@ -172,7 +174,8 @@ Y_UNIT_TEST(BuildYtJoinTree2Tables) {
172
174
173
175
Y_UNIT_TEST (BuildYtJoinTree2TablesForceMergeJoib) {
174
176
const TString cluster (" ut_cluster" );
175
- TYtState::TPtr state = MakeIntrusive<TYtState>();
177
+ TTypeAnnotationContext typeCtx;
178
+ TYtState::TPtr state = MakeIntrusive<TYtState>(&typeCtx);
176
179
TExprContext exprCtx;
177
180
auto tree = MakeOp ({" c" , " c_nationkey" }, {" n" , " n_nationkey" }, {" c" , " n" }, exprCtx);
178
181
tree->Left = MakeLeaf ({" c" }, {" c" }, 100000 , 12333 , exprCtx);
@@ -191,7 +194,8 @@ Y_UNIT_TEST(BuildYtJoinTree2TablesForceMergeJoib) {
191
194
192
195
Y_UNIT_TEST (BuildYtJoinTree2TablesComplexLabel) {
193
196
const TString cluster (" ut_cluster" );
194
- TYtState::TPtr state = MakeIntrusive<TYtState>();
197
+ TTypeAnnotationContext typeCtx;
198
+ TYtState::TPtr state = MakeIntrusive<TYtState>(&typeCtx);
195
199
TExprContext exprCtx;
196
200
auto tree = MakeOp ({" c" , " c_nationkey" }, {" n" , " n_nationkey" }, {" c" , " n" , " e" }, exprCtx);
197
201
tree->Left = MakeLeaf ({" c" }, {" c" }, 1000000 , 1233333 , exprCtx);
@@ -209,7 +213,8 @@ Y_UNIT_TEST(BuildYtJoinTree2TablesComplexLabel) {
209
213
Y_UNIT_TEST (BuildYtJoinTree2TablesTableIn2Rels)
210
214
{
211
215
const TString cluster (" ut_cluster" );
212
- TYtState::TPtr state = MakeIntrusive<TYtState>();
216
+ TTypeAnnotationContext typeCtx;
217
+ TYtState::TPtr state = MakeIntrusive<TYtState>(&typeCtx);
213
218
TExprContext exprCtx;
214
219
auto tree = MakeOp ({" c" , " c_nationkey" }, {" n" , " n_nationkey" }, {" c" , " n" , " c" }, exprCtx);
215
220
tree->Left = MakeLeaf ({" c" }, {" c" }, 1000000 , 1233333 , exprCtx);
@@ -239,10 +244,9 @@ void OrderJoins2Tables(auto optimizerType) {
239
244
tree->Left = MakeLeaf ({" c" }, {" c" }, 100000 , 12333 , exprCtx);
240
245
tree->Right = MakeLeaf ({" n" }, {" n" }, 1000 , 1233 , exprCtx);
241
246
242
- TYtState::TPtr state = MakeIntrusive<TYtState>();
243
247
TTypeAnnotationContext typeCtx;
244
248
typeCtx.CostBasedOptimizer = optimizerType;
245
- state-> Types = &typeCtx;
249
+ TYtState::TPtr state = MakeIntrusive<TYtState>( &typeCtx) ;
246
250
auto optimizedTree = OrderJoins (tree, state, cluster, exprCtx, true );
247
251
UNIT_ASSERT (optimizedTree != tree);
248
252
UNIT_ASSERT (optimizedTree->Left );
@@ -269,9 +273,8 @@ void OrderJoins2TablesComplexLabel(auto optimizerType)
269
273
tree->Right = MakeLeaf ({" n" }, {" n" , " e" }, 10000 , 12333 , exprCtx);
270
274
271
275
TTypeAnnotationContext typeCtx;
272
- TYtState::TPtr state = MakeIntrusive<TYtState>();
273
276
typeCtx.CostBasedOptimizer = optimizerType;
274
- state-> Types = &typeCtx;
277
+ TYtState::TPtr state = MakeIntrusive<TYtState>( &typeCtx) ;
275
278
auto optimizedTree = OrderJoins (tree, state, cluster, exprCtx, true );
276
279
UNIT_ASSERT (optimizedTree != tree);
277
280
}
@@ -287,9 +290,8 @@ void OrderJoins2TablesTableIn2Rels(auto optimizerType)
287
290
tree->Right = MakeLeaf ({" n" }, {" n" , " c" }, 10000 , 12333 , exprCtx);
288
291
289
292
TTypeAnnotationContext typeCtx;
290
- TYtState::TPtr state = MakeIntrusive<TYtState>();
291
293
typeCtx.CostBasedOptimizer = optimizerType;
292
- state-> Types = &typeCtx;
294
+ TYtState::TPtr state = MakeIntrusive<TYtState>( &typeCtx) ;
293
295
auto optimizedTree = OrderJoins (tree, state, cluster, exprCtx, true );
294
296
UNIT_ASSERT (optimizedTree != tree);
295
297
}
@@ -306,9 +308,8 @@ Y_UNIT_TEST(OrderLeftJoin)
306
308
tree->JoinKind = exprCtx.NewAtom (exprCtx.AppendPosition ({}), " Left" );
307
309
308
310
TTypeAnnotationContext typeCtx;
309
- TYtState::TPtr state = MakeIntrusive<TYtState>();
310
311
typeCtx.CostBasedOptimizer = ECostBasedOptimizerType::PG;
311
- state-> Types = &typeCtx;
312
+ TYtState::TPtr state = MakeIntrusive<TYtState>( &typeCtx) ;
312
313
auto optimizedTree = OrderJoins (tree, state, cluster, exprCtx, true );
313
314
UNIT_ASSERT (optimizedTree != tree);
314
315
UNIT_ASSERT_STRINGS_EQUAL (" Left" , optimizedTree->JoinKind ->Content ());
@@ -324,9 +325,8 @@ Y_UNIT_TEST(UnsupportedJoin)
324
325
tree->JoinKind = exprCtx.NewAtom (exprCtx.AppendPosition ({}), " RightSemi" );
325
326
326
327
TTypeAnnotationContext typeCtx;
327
- TYtState::TPtr state = MakeIntrusive<TYtState>();
328
328
typeCtx.CostBasedOptimizer = ECostBasedOptimizerType::PG;
329
- state-> Types = &typeCtx;
329
+ TYtState::TPtr state = MakeIntrusive<TYtState>( &typeCtx) ;
330
330
auto optimizedTree = OrderJoins (tree, state, cluster, exprCtx, true );
331
331
UNIT_ASSERT (optimizedTree == tree);
332
332
}
@@ -340,9 +340,8 @@ Y_UNIT_TEST(OrderJoinSinglePass) {
340
340
tree->JoinKind = exprCtx.NewAtom (exprCtx.AppendPosition ({}), " Left" );
341
341
342
342
TTypeAnnotationContext typeCtx;
343
- TYtState::TPtr state = MakeIntrusive<TYtState>();
344
343
typeCtx.CostBasedOptimizer = ECostBasedOptimizerType::PG;
345
- state-> Types = &typeCtx;
344
+ TYtState::TPtr state = MakeIntrusive<TYtState>( &typeCtx) ;
346
345
auto optimizedTree = OrderJoins (tree, state, cluster, exprCtx, true );
347
346
UNIT_ASSERT (optimizedTree != tree);
348
347
UNIT_ASSERT (optimizedTree->CostBasedOptPassed );
@@ -358,9 +357,8 @@ Y_UNIT_TEST(OrderJoinsDoesNothingWhenCBOAlreadyPassed) {
358
357
tree->CostBasedOptPassed = true ;
359
358
360
359
TTypeAnnotationContext typeCtx;
361
- TYtState::TPtr state = MakeIntrusive<TYtState>();
362
360
typeCtx.CostBasedOptimizer = ECostBasedOptimizerType::PG;
363
- state-> Types = &typeCtx;
361
+ TYtState::TPtr state = MakeIntrusive<TYtState>( &typeCtx) ;
364
362
auto optimizedTree = OrderJoins (tree, state, cluster, exprCtx, true );
365
363
UNIT_ASSERT (optimizedTree == tree);
366
364
}
0 commit comments