@@ -251,15 +251,16 @@ public LocalQueryRunner(Session defaultSession)
251
251
new FeaturesConfig ()
252
252
.setOptimizeMixedDistinctAggregations (true )
253
253
.setIterativeOptimizerEnabled (true ),
254
- false );
254
+ false ,
255
+ 1 );
255
256
}
256
257
257
258
public LocalQueryRunner (Session defaultSession , FeaturesConfig featuresConfig )
258
259
{
259
- this (defaultSession , featuresConfig , false );
260
+ this (defaultSession , featuresConfig , false , 1 );
260
261
}
261
262
262
- private LocalQueryRunner (Session defaultSession , FeaturesConfig featuresConfig , boolean withInitialTransaction )
263
+ private LocalQueryRunner (Session defaultSession , FeaturesConfig featuresConfig , boolean withInitialTransaction , int nodeCountForStats )
263
264
{
264
265
requireNonNull (defaultSession , "defaultSession is null" );
265
266
checkArgument (!defaultSession .getTransactionId ().isPresent () || !withInitialTransaction , "Already in transaction" );
@@ -379,14 +380,19 @@ private LocalQueryRunner(Session defaultSession, FeaturesConfig featuresConfig,
379
380
new CoefficientBasedStatsCalculator (metadata ),
380
381
ServerMainModule .createNewStatsCalculator (metadata , new FilterStatsCalculator (metadata ), new ScalarStatsCalculator (metadata )));
381
382
this .costCalculator = new CostCalculatorUsingExchanges (getNodeCount ());
382
- this .estimatedExchangesCostCalculator = new CostCalculatorWithEstimatedExchanges (costCalculator , getNodeCount () );
383
+ this .estimatedExchangesCostCalculator = new CostCalculatorWithEstimatedExchanges (costCalculator , nodeCountForStats );
383
384
this .lookup = new StatelessLookup (statsCalculator , costCalculator );
384
385
}
385
386
386
387
public static LocalQueryRunner queryRunnerWithInitialTransaction (Session defaultSession )
387
388
{
388
389
checkArgument (!defaultSession .getTransactionId ().isPresent (), "Already in transaction!" );
389
- return new LocalQueryRunner (defaultSession , new FeaturesConfig (), true );
390
+ return new LocalQueryRunner (defaultSession , new FeaturesConfig (), true , 1 );
391
+ }
392
+
393
+ public static LocalQueryRunner queryRunnerWithFakeNodeCountForStats (Session defaultSession , int nodeCount )
394
+ {
395
+ return new LocalQueryRunner (defaultSession , new FeaturesConfig (), false , nodeCount );
390
396
}
391
397
392
398
@ Override
0 commit comments