Search in sources :

Example 1 with ConnectorFilterStatsCalculatorService

use of io.prestosql.cost.ConnectorFilterStatsCalculatorService 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 ConnectorFilterStatsCalculatorService

use of io.prestosql.cost.ConnectorFilterStatsCalculatorService 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)

Example 3 with ConnectorFilterStatsCalculatorService

use of io.prestosql.cost.ConnectorFilterStatsCalculatorService in project hetu-core by openlookeng.

the class ConnectorManager method createConnector.

public Connector createConnector(CatalogName catalogName, ConnectorFactory factory, Map<String, String> properties) {
    ConnectorContext context = new ConnectorContextInstance(new ConnectorAwareNodeManager(nodeManager, nodeInfo.getEnvironment(), catalogName), versionEmbedder, new InternalTypeManager(metadataManager.getFunctionAndTypeManager()), pageSorter, pageIndexerFactory, hetuMetaStoreManager.getHetuMetastore(), heuristicIndexerManager.getIndexClient(), new ConnectorRowExpressionService(domainTranslator, determinismEvaluator), metadataManager.getFunctionAndTypeManager(), new FunctionResolution(metadataManager.getFunctionAndTypeManager()), metadataManager.getFunctionAndTypeManager().getBlockEncodingSerde(), new ConnectorFilterStatsCalculatorService(filterStatsCalculator));
    try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(factory.getClass().getClassLoader())) {
        Connector connector = factory.create(catalogName.getCatalogName(), properties, context);
        registerExternalFunctions(connector.getExternalFunctionHub(), metadataManager.getFunctionAndTypeManager());
        return connector;
    }
}
Also used : ConnectorFilterStatsCalculatorService(io.prestosql.cost.ConnectorFilterStatsCalculatorService) Connector(io.prestosql.spi.connector.Connector) InformationSchemaConnector(io.prestosql.connector.informationschema.InformationSchemaConnector) SystemConnector(io.prestosql.connector.system.SystemConnector) ConnectorRowExpressionService(io.prestosql.sql.relational.ConnectorRowExpressionService) ConnectorContext(io.prestosql.spi.connector.ConnectorContext) InternalTypeManager(io.prestosql.type.InternalTypeManager) FunctionResolution(io.prestosql.sql.relational.FunctionResolution) ThreadContextClassLoader(io.prestosql.spi.classloader.ThreadContextClassLoader)

Aggregations

ConnectorFilterStatsCalculatorService (io.prestosql.cost.ConnectorFilterStatsCalculatorService)3 ConnectorRowExpressionService (io.prestosql.sql.relational.ConnectorRowExpressionService)3 FunctionResolution (io.prestosql.sql.relational.FunctionResolution)3 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 RowExpressionDeterminismEvaluator (io.prestosql.sql.relational.RowExpressionDeterminismEvaluator)2 RowExpressionDomainTranslator (io.prestosql.sql.relational.RowExpressionDomainTranslator)2 InformationSchemaConnector (io.prestosql.connector.informationschema.InformationSchemaConnector)1 SystemConnector (io.prestosql.connector.system.SystemConnector)1 HiveMetadata (io.prestosql.plugin.hive.HiveMetadata)1 HiveMetadataFactory (io.prestosql.plugin.hive.HiveMetadataFactory)1 TestHivePushdownUtil.simulationHiveMetadata (io.prestosql.plugin.hive.rule.TestHivePushdownUtil.simulationHiveMetadata)1 ThreadContextClassLoader (io.prestosql.spi.classloader.ThreadContextClassLoader)1