Search in sources :

Example 1 with HivePartitionManager

use of io.prestosql.plugin.hive.HivePartitionManager 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);
}
Also used : ConnectorFilterStatsCalculatorService(io.prestosql.cost.ConnectorFilterStatsCalculatorService) RowExpressionDeterminismEvaluator(io.prestosql.sql.relational.RowExpressionDeterminismEvaluator) StatsNormalizer(io.prestosql.cost.StatsNormalizer) HiveMetadataFactory(io.prestosql.plugin.hive.HiveMetadataFactory) ConnectorRowExpressionService(io.prestosql.sql.relational.ConnectorRowExpressionService) HivePartitionManager(io.prestosql.plugin.hive.HivePartitionManager) FilterStatsCalculatorService(io.prestosql.spi.plan.FilterStatsCalculatorService) ConnectorFilterStatsCalculatorService(io.prestosql.cost.ConnectorFilterStatsCalculatorService) ScalarStatsCalculator(io.prestosql.cost.ScalarStatsCalculator) RowExpressionDomainTranslator(io.prestosql.sql.relational.RowExpressionDomainTranslator) FilterStatsCalculator(io.prestosql.cost.FilterStatsCalculator) StandardFunctionResolution(io.prestosql.spi.function.StandardFunctionResolution) FunctionResolution(io.prestosql.sql.relational.FunctionResolution) RowExpressionService(io.prestosql.spi.relation.RowExpressionService) ConnectorRowExpressionService(io.prestosql.sql.relational.ConnectorRowExpressionService) TestHivePushdownUtil.simulationHiveMetadata(io.prestosql.plugin.hive.rule.TestHivePushdownUtil.simulationHiveMetadata) HiveMetadata(io.prestosql.plugin.hive.HiveMetadata) StandardFunctionResolution(io.prestosql.spi.function.StandardFunctionResolution) HiveTransactionManager(io.prestosql.plugin.hive.HiveTransactionManager) TestHivePushdownUtil.simulationHiveTransactionManager(io.prestosql.plugin.hive.rule.TestHivePushdownUtil.simulationHiveTransactionManager) Test(org.testng.annotations.Test)

Example 2 with HivePartitionManager

use of io.prestosql.plugin.hive.HivePartitionManager 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;
}
Also used : ConnectorFilterStatsCalculatorService(io.prestosql.cost.ConnectorFilterStatsCalculatorService) RowExpressionDeterminismEvaluator(io.prestosql.sql.relational.RowExpressionDeterminismEvaluator) StatsNormalizer(io.prestosql.cost.StatsNormalizer) ConnectorRowExpressionService(io.prestosql.sql.relational.ConnectorRowExpressionService) HivePartitionManager(io.prestosql.plugin.hive.HivePartitionManager) ConnectorFilterStatsCalculatorService(io.prestosql.cost.ConnectorFilterStatsCalculatorService) FilterStatsCalculatorService(io.prestosql.spi.plan.FilterStatsCalculatorService) ScalarStatsCalculator(io.prestosql.cost.ScalarStatsCalculator) RowExpressionDomainTranslator(io.prestosql.sql.relational.RowExpressionDomainTranslator) FilterStatsCalculator(io.prestosql.cost.FilterStatsCalculator) StandardFunctionResolution(io.prestosql.spi.function.StandardFunctionResolution) FunctionResolution(io.prestosql.sql.relational.FunctionResolution) RowExpressionService(io.prestosql.spi.relation.RowExpressionService) ConnectorRowExpressionService(io.prestosql.sql.relational.ConnectorRowExpressionService) StandardFunctionResolution(io.prestosql.spi.function.StandardFunctionResolution) HiveTransactionManager(io.prestosql.plugin.hive.HiveTransactionManager) TestHivePushdownUtil.simulationHiveTransactionManager(io.prestosql.plugin.hive.rule.TestHivePushdownUtil.simulationHiveTransactionManager)

Aggregations

ConnectorFilterStatsCalculatorService (io.prestosql.cost.ConnectorFilterStatsCalculatorService)2 FilterStatsCalculator (io.prestosql.cost.FilterStatsCalculator)2 ScalarStatsCalculator (io.prestosql.cost.ScalarStatsCalculator)2 StatsNormalizer (io.prestosql.cost.StatsNormalizer)2 HivePartitionManager (io.prestosql.plugin.hive.HivePartitionManager)2 HiveTransactionManager (io.prestosql.plugin.hive.HiveTransactionManager)2 TestHivePushdownUtil.simulationHiveTransactionManager (io.prestosql.plugin.hive.rule.TestHivePushdownUtil.simulationHiveTransactionManager)2 StandardFunctionResolution (io.prestosql.spi.function.StandardFunctionResolution)2 FilterStatsCalculatorService (io.prestosql.spi.plan.FilterStatsCalculatorService)2 RowExpressionService (io.prestosql.spi.relation.RowExpressionService)2 ConnectorRowExpressionService (io.prestosql.sql.relational.ConnectorRowExpressionService)2 FunctionResolution (io.prestosql.sql.relational.FunctionResolution)2 RowExpressionDeterminismEvaluator (io.prestosql.sql.relational.RowExpressionDeterminismEvaluator)2 RowExpressionDomainTranslator (io.prestosql.sql.relational.RowExpressionDomainTranslator)2 HiveMetadata (io.prestosql.plugin.hive.HiveMetadata)1 HiveMetadataFactory (io.prestosql.plugin.hive.HiveMetadataFactory)1 TestHivePushdownUtil.simulationHiveMetadata (io.prestosql.plugin.hive.rule.TestHivePushdownUtil.simulationHiveMetadata)1 Test (org.testng.annotations.Test)1