use of io.prestosql.cost.ScalarStatsCalculator in project boostkit-bigdata by kunpengcompute.
the class TestHivePlanOptimizerProvider method testProvider.
@Test
public void testProvider() {
RowExpressionService expressionService = new ConnectorRowExpressionService(new RowExpressionDomainTranslator(OFFLOAD_METADATA), new RowExpressionDeterminismEvaluator(OFFLOAD_METADATA));
HiveTransactionManager transactionManager = simulationHiveTransactionManager();
StandardFunctionResolution resolution = new FunctionResolution(OFFLOAD_METADATA.getFunctionAndTypeManager());
HivePartitionManager partitionManager = new HivePartitionManager(OFFLOAD_METADATA.getFunctionAndTypeManager(), 1, false, 1);
ScalarStatsCalculator scalarStatsCalculator = new ScalarStatsCalculator(OFFLOAD_METADATA);
StatsNormalizer normalizer = new StatsNormalizer();
FilterStatsCalculator statsCalculator = new FilterStatsCalculator(OFFLOAD_METADATA, scalarStatsCalculator, normalizer);
FilterStatsCalculatorService calculatorService = new ConnectorFilterStatsCalculatorService(statsCalculator);
HiveMetadataFactory hiveMetadataFactory = Mockito.mock(HiveMetadataFactory.class);
HiveMetadata hiveMetadata = simulationHiveMetadata();
Mockito.when(hiveMetadataFactory.get()).thenReturn(hiveMetadata);
HivePlanOptimizerProvider hivePlanOptimizerProvider = new HivePlanOptimizerProvider(transactionManager, expressionService, resolution, partitionManager, OFFLOAD_METADATA.getFunctionAndTypeManager(), calculatorService, hiveMetadataFactory);
assertEquals(hivePlanOptimizerProvider.getLogicalPlanOptimizers().size(), 3);
assertEquals(hivePlanOptimizerProvider.getPhysicalPlanOptimizers().size(), 3);
}
use of io.prestosql.cost.ScalarStatsCalculator in project boostkit-bigdata by kunpengcompute.
the class TestHiveFilterPushdown method createOptimizer.
private static HiveFilterPushdown createOptimizer() {
RowExpressionService expressionService = new ConnectorRowExpressionService(new RowExpressionDomainTranslator(OFFLOAD_METADATA), new RowExpressionDeterminismEvaluator(OFFLOAD_METADATA));
HiveTransactionManager transactionManager = simulationHiveTransactionManager();
StandardFunctionResolution resolution = new FunctionResolution(OFFLOAD_METADATA.getFunctionAndTypeManager());
HivePartitionManager partitionManager = new HivePartitionManager(OFFLOAD_METADATA.getFunctionAndTypeManager(), 1, false, 1);
ScalarStatsCalculator scalarStatsCalculator = new ScalarStatsCalculator(OFFLOAD_METADATA);
StatsNormalizer normalizer = new StatsNormalizer();
FilterStatsCalculator statsCalculator = new FilterStatsCalculator(OFFLOAD_METADATA, scalarStatsCalculator, normalizer);
FilterStatsCalculatorService calculatorService = new ConnectorFilterStatsCalculatorService(statsCalculator);
HiveFilterPushdown optimizer = new HiveFilterPushdown(transactionManager, expressionService, resolution, partitionManager, calculatorService, OFFLOAD_METADATA.getFunctionAndTypeManager());
return optimizer;
}
Aggregations