use of io.prestosql.sql.analyzer.FeaturesConfig in project hetu-core by openlookeng.
the class TestStarTreeAggregationRule method setupBeforeClass.
@BeforeClass
public void setupBeforeClass() {
PlanSymbolAllocator symbolAllocator = new PlanSymbolAllocator();
columnOrderkey = symbolAllocator.newSymbol("orderkey", BIGINT);
columnOrderDate = symbolAllocator.newSymbol("orderdate", DATE);
columnCustkey = symbolAllocator.newSymbol("custkey", BIGINT);
columnTotalprice = symbolAllocator.newSymbol("totalprice", DOUBLE);
orderkeyHandle = new TpchColumnHandle("orderkey", BIGINT);
orderdateHandle = new TpchColumnHandle("orderdate", DATE);
custkeyHandle = new TpchColumnHandle("custkey", BIGINT);
totalpriceHandle = new TpchColumnHandle("totalprice", DOUBLE);
ColumnMetadata orderKeyColumnMetadata = new ColumnMetadata(orderkeyHandle.getColumnName(), orderkeyHandle.getType());
ColumnMetadata orderDateColumnMetadata = new ColumnMetadata(orderdateHandle.getColumnName(), orderdateHandle.getType());
ColumnMetadata custKeyColumnMetadata = new ColumnMetadata(custkeyHandle.getColumnName(), custkeyHandle.getType());
ColumnMetadata totalPriceColumnMetadata = new ColumnMetadata(totalpriceHandle.getColumnName(), totalpriceHandle.getType());
output = symbolAllocator.newSymbol("output", DOUBLE);
assignments = ImmutableMap.<Symbol, ColumnHandle>builder().put(columnOrderkey, orderkeyHandle).put(columnOrderDate, orderdateHandle).put(columnCustkey, custkeyHandle).put(columnTotalprice, totalpriceHandle).build();
TpchTableHandle orders = new TpchTableHandle("orders", 1.0);
ordersTableHandle = new TableHandle(tester().getCurrentConnectorId(), orders, TpchTransactionHandle.INSTANCE, Optional.of(new TpchTableLayoutHandle(orders, TupleDomain.all())));
baseTableScan = new TableScanNode(newId(), ordersTableHandle, ImmutableList.copyOf(assignments.keySet()), assignments, TupleDomain.all(), Optional.empty(), ReuseExchangeOperator.STRATEGY.REUSE_STRATEGY_DEFAULT, new UUID(0, 0), 0, false);
QualifiedObjectName baseTableName = QualifiedObjectName.valueOf(baseTableScan.getTable().getFullyQualifiedName());
baseTableMetadata = new TableMetadata(ordersTableHandle.getCatalogName(), new ConnectorTableMetadata(new SchemaTableName(baseTableName.getSchemaName(), baseTableName.getObjectName()), Arrays.asList(orderKeyColumnMetadata, orderDateColumnMetadata, custKeyColumnMetadata, totalPriceColumnMetadata)));
columnCountAll = symbolAllocator.newSymbol("count_all", BIGINT);
columnSumTotalPrice = symbolAllocator.newSymbol("sum_totalprice", DOUBLE);
columnCountOrderKey = symbolAllocator.newSymbol("count_orderkey", BIGINT);
columnGroupingBitSet = symbolAllocator.newSymbol("grouping_bit_set", BIGINT);
cubeColumnCustKey = symbolAllocator.newSymbol("custkey", BIGINT);
cubeColumnOrderDate = symbolAllocator.newSymbol("orderdate", DATE);
countAllHandle = new TpchColumnHandle("count_all", BIGINT);
sumTotalPriceHandle = new TpchColumnHandle("sum_totalprice", DOUBLE);
countOrderKeyHandle = new TpchColumnHandle("count_orderkey", BIGINT);
groupingBitSetHandle = new TpchColumnHandle("grouping_bit_set", BIGINT);
custKeyCubeColumnHandle = new TpchColumnHandle("custkey", BIGINT);
orderDateCubeColumnHandle = new TpchColumnHandle("orderdate", DATE);
ordersCubeColumnHandles.put(countAllHandle.getColumnName(), countAllHandle);
ordersCubeColumnHandles.put(sumTotalPriceHandle.getColumnName(), sumTotalPriceHandle);
ordersCubeColumnHandles.put(countOrderKeyHandle.getColumnName(), countOrderKeyHandle);
ordersCubeColumnHandles.put(groupingBitSetHandle.getColumnName(), groupingBitSetHandle);
ordersCubeColumnHandles.put(custKeyCubeColumnHandle.getColumnName(), custKeyCubeColumnHandle);
ordersCubeColumnHandles.put(orderDateCubeColumnHandle.getColumnName(), orderDateCubeColumnHandle);
TpchTableHandle ordersCube = new TpchTableHandle("orders_cube", 1.0);
ordersCubeHandle = new TableHandle(tester().getCurrentConnectorId(), ordersCube, TpchTransactionHandle.INSTANCE, Optional.of(new TpchTableLayoutHandle(ordersCube, TupleDomain.all())));
countAllColumnMetadata = new ColumnMetadata(countAllHandle.getColumnName(), countAllHandle.getType());
sumTotalPriceColumnMetadata = new ColumnMetadata(sumTotalPriceHandle.getColumnName(), sumTotalPriceHandle.getType());
countOrderKeyColumnMetadata = new ColumnMetadata(countOrderKeyHandle.getColumnName(), countOrderKeyHandle.getType());
groupingBitSetColumnMetadata = new ColumnMetadata(groupingBitSetHandle.getColumnName(), groupingBitSetHandle.getType());
custKeyCubeColumnMetadata = new ColumnMetadata(custKeyCubeColumnHandle.getColumnName(), custKeyCubeColumnHandle.getType());
orderDateCubeColumnMetadata = new ColumnMetadata(orderDateCubeColumnHandle.getColumnName(), orderDateCubeColumnHandle.getType());
config = new FeaturesConfig();
config.setEnableStarTreeIndex(true);
cubeManager = Mockito.mock(CubeManager.class);
provider = Mockito.mock(CubeProvider.class);
cubeMetaStore = Mockito.mock(CubeMetaStore.class);
cubeMetadata = Mockito.mock(CubeMetadata.class);
ordersTableHandleMatcher = new BaseMatcher<TableHandle>() {
@Override
public boolean matches(Object o) {
if (!(o instanceof TableHandle)) {
return false;
}
TableHandle th = (TableHandle) o;
return th.getFullyQualifiedName().equals(ordersTableHandle.getFullyQualifiedName());
}
@Override
public void describeTo(Description description) {
}
};
ordersCubeHandleMatcher = new BaseMatcher<TableHandle>() {
@Override
public boolean matches(Object o) {
if (!(o instanceof TableHandle)) {
return false;
}
TableHandle th = (TableHandle) o;
return th.getFullyQualifiedName().equals(ordersCubeHandle.getFullyQualifiedName());
}
@Override
public void describeTo(Description description) {
}
};
countAllColumnHandleMatcher = new BaseMatcher<ColumnHandle>() {
@Override
public void describeTo(Description description) {
}
@Override
public boolean matches(Object o) {
if (!(o instanceof ColumnHandle)) {
return false;
}
ColumnHandle ch = (ColumnHandle) o;
return ch.getColumnName().equalsIgnoreCase(countAllHandle.getColumnName());
}
};
sumTotalPriceColumnHandleMatcher = new BaseMatcher<ColumnHandle>() {
@Override
public void describeTo(Description description) {
}
@Override
public boolean matches(Object o) {
if (!(o instanceof ColumnHandle)) {
return false;
}
ColumnHandle ch = (ColumnHandle) o;
return ch.getColumnName().equalsIgnoreCase(sumTotalPriceHandle.getColumnName());
}
};
countOrderKeyColumnHandleMatcher = new BaseMatcher<ColumnHandle>() {
@Override
public boolean matches(Object o) {
if (!(o instanceof ColumnHandle)) {
return false;
}
ColumnHandle ch = (ColumnHandle) o;
return ch.getColumnName().equalsIgnoreCase(countOrderKeyHandle.getColumnName());
}
@Override
public void describeTo(Description description) {
}
};
groupingBitSetColumnHandleMatcher = new BaseMatcher<ColumnHandle>() {
@Override
public boolean matches(Object o) {
if (!(o instanceof ColumnHandle)) {
return false;
}
ColumnHandle ch = (ColumnHandle) o;
return ch.getColumnName().equalsIgnoreCase(groupingBitSetHandle.getColumnName());
}
@Override
public void describeTo(Description description) {
}
};
orderDateCubeColumnHandleMatcher = new BaseMatcher<ColumnHandle>() {
@Override
public boolean matches(Object o) {
if (!(o instanceof ColumnHandle)) {
return false;
}
ColumnHandle ch = (ColumnHandle) o;
return ch.getColumnName().equalsIgnoreCase(orderDateCubeColumnHandle.getColumnName());
}
@Override
public void describeTo(Description description) {
}
};
custKeyCubeColumnHandleMatcher = new BaseMatcher<ColumnHandle>() {
@Override
public boolean matches(Object o) {
if (!(o instanceof ColumnHandle)) {
return false;
}
ColumnHandle ch = (ColumnHandle) o;
return ch.getColumnName().equalsIgnoreCase(custKeyCubeColumnHandle.getColumnName());
}
@Override
public void describeTo(Description description) {
}
};
}
use of io.prestosql.sql.analyzer.FeaturesConfig in project hetu-core by openlookeng.
the class TestStarTreeMetaStore method setup.
@BeforeClass
public void setup() {
FeaturesConfig featuresConfig = new FeaturesConfig();
featuresConfig.setCubeMetadataCacheTtl(Duration.valueOf("5m"));
featuresConfig.setCubeMetadataCacheSize(1000);
Properties properties = new Properties();
properties.setProperty("cache-ttl", Long.toString(featuresConfig.getCubeMetadataCacheTtl().toMillis()));
properties.setProperty("cache-size", Long.toString(featuresConfig.getCubeMetadataCacheSize()));
metaStore = new MockMetaStore();
cubeMetadataService = new StarTreeProvider().getCubeMetaStore(metaStore, properties);
cubeMetadata1 = new StarTreeMetadata("star1", "a", 1000, ImmutableList.of(new AggregateColumn("sum_cost", "SUM", "cost", false), new DimensionColumn("value", "value")), ImmutableList.of(ImmutableSet.of("value")), null, 10000, CubeStatus.READY);
cubeMetadata2 = new StarTreeMetadata("star2", "a", 1000, ImmutableList.of(new AggregateColumn("sum_cost", "SUM", "cost", false), new DimensionColumn("value", "value")), ImmutableList.of(ImmutableSet.of("value")), null, 10000, CubeStatus.READY);
}
use of io.prestosql.sql.analyzer.FeaturesConfig in project hetu-core by openlookeng.
the class TestAddExchangesPlans method createQueryRunner.
private static LocalQueryRunner createQueryRunner() {
Session session = testSessionBuilder().setCatalog("tpch").setSchema("tiny").build();
FeaturesConfig featuresConfig = new FeaturesConfig().setSpillerSpillPaths("/tmp/test_spill_path");
LocalQueryRunner queryRunner = new LocalQueryRunner(session, featuresConfig);
queryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of());
return queryRunner;
}
use of io.prestosql.sql.analyzer.FeaturesConfig in project hetu-core by openlookeng.
the class TestPruneCTENodes method createQueryRunner.
private static LocalQueryRunner createQueryRunner() {
Session session = testSessionBuilder().setCatalog("tpch").setSchema("tiny").build();
FeaturesConfig featuresConfig = new FeaturesConfig().setSpillerSpillPaths("/tmp/test_spill_path");
LocalQueryRunner queryRunner = new LocalQueryRunner(session, featuresConfig);
queryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of());
return queryRunner;
}
use of io.prestosql.sql.analyzer.FeaturesConfig in project hetu-core by openlookeng.
the class AbstractTestQueryFramework method getQueryExplainer.
private QueryExplainer getQueryExplainer() {
Metadata metadata = queryRunner.getMetadata();
FeaturesConfig featuresConfig = new FeaturesConfig().setOptimizeHashGeneration(true);
boolean forceSingleNode = queryRunner.getNodeCount() == 1;
TaskCountEstimator taskCountEstimator = new TaskCountEstimator(queryRunner::getNodeCount);
CostCalculator costCalculator = new CostCalculatorUsingExchanges(taskCountEstimator);
HetuMetaStoreManager hetuMetaStoreManager = new HetuMetaStoreManager();
List<PlanOptimizer> optimizers = new PlanOptimizers(metadata, new TypeAnalyzer(sqlParser, metadata), featuresConfig, new TaskManagerConfig(), forceSingleNode, new MBeanExporter(new TestingMBeanServer()), queryRunner.getSplitManager(), queryRunner.getPlanOptimizerManager(), queryRunner.getPageSourceManager(), queryRunner.getStatsCalculator(), costCalculator, new CostCalculatorWithEstimatedExchanges(costCalculator, taskCountEstimator), new CostComparator(featuresConfig), taskCountEstimator, new CubeManager(featuresConfig, hetuMetaStoreManager)).get();
return new QueryExplainer(optimizers, new PlanFragmenter(metadata, queryRunner.getNodePartitioningManager(), new QueryManagerConfig()), metadata, queryRunner.getAccessControl(), sqlParser, queryRunner.getStatsCalculator(), costCalculator, ImmutableMap.of(), new HeuristicIndexerManager(null, null), new CubeManager(featuresConfig, hetuMetaStoreManager));
}
Aggregations