use of io.prestosql.plugin.tpch.TpchTableHandle in project hetu-core by openlookeng.
the class TestStarTreeAggregationRule method testDoNotFireWhenMatchingCubeNotFound.
@Test
public void testDoNotFireWhenMatchingCubeNotFound() {
Mockito.when(cubeManager.getCubeProvider(anyString())).then(new Returns(Optional.of(provider)));
Mockito.when(cubeManager.getMetaStore(anyString())).then(new Returns(Optional.of(cubeMetaStore)));
TpchTableHandle orders = new TpchTableHandle("orders", 1.0);
TableHandle tmpOrdersTableHandle = new TableHandle(tester().getCurrentConnectorId(), orders, TpchTransactionHandle.INSTANCE, Optional.of(new TpchTableLayoutHandle(orders, TupleDomain.all())));
List<CubeMetadata> metadataList = ImmutableList.of(cubeMetadata);
Mockito.when(cubeMetaStore.getMetadataList(eq("local.sf1.0.orders"))).then(new Returns(metadataList));
Mockito.when(cubeMetadata.matches(any(CubeStatement.class))).thenReturn(false);
StarTreeAggregationRule starTreeAggregationRule = new StarTreeAggregationRule(cubeManager, tester().getMetadata());
tester().assertThat(starTreeAggregationRule).setSystemProperty(ENABLE_STAR_TREE_INDEX, "true").on(p -> p.aggregation(builder -> builder.globalGrouping().addAggregation(p.symbol("count", BIGINT), new FunctionCallBuilder(tester().getMetadata()).setName(QualifiedName.of("count")).build(), ImmutableList.of(BIGINT)).step(SINGLE).source(p.project(Assignments.builder().put(p.symbol("custkey"), OriginalExpressionUtils.castToRowExpression(SymbolUtils.toSymbolReference(p.symbol("custkey")))).build(), p.filter(expression("orderkey=1"), p.tableScan(tmpOrdersTableHandle, ImmutableList.of(p.symbol("orderkey", BIGINT)), ImmutableMap.of(p.symbol("orderkey", BIGINT), new TpchColumnHandle("orderkey", BIGINT)))))))).doesNotFire();
Mockito.verify(cubeMetaStore, Mockito.atLeastOnce()).getMetadataList(eq("local.sf1.0.orders"));
Mockito.verify(cubeMetadata, Mockito.atLeastOnce()).matches(any(CubeStatement.class));
}
use of io.prestosql.plugin.tpch.TpchTableHandle in project hetu-core by openlookeng.
the class TestValidateAggregationsWithDefaultValues method setup.
@BeforeClass
public void setup() {
metadata = getQueryRunner().getMetadata();
builder = new PlanBuilder(new PlanNodeIdAllocator(), metadata);
CatalogName catalogName = getCurrentConnectorId();
TableHandle nationTableHandle = new TableHandle(catalogName, new TpchTableHandle("nation", 1.0), TestingTransactionHandle.create(), Optional.empty());
TpchColumnHandle nationkeyColumnHandle = new TpchColumnHandle("nationkey", BIGINT);
symbol = new Symbol("nationkey");
tableScanNode = builder.tableScan(nationTableHandle, ImmutableList.of(symbol), ImmutableMap.of(symbol, nationkeyColumnHandle));
}
use of io.prestosql.plugin.tpch.TpchTableHandle in project hetu-core by openlookeng.
the class TestValidateStreamingAggregations method setup.
@BeforeClass
public void setup() {
metadata = getQueryRunner().getMetadata();
typeAnalyzer = new TypeAnalyzer(getQueryRunner().getSqlParser(), metadata);
CatalogName catalogName = getCurrentConnectorId();
nationTableHandle = new TableHandle(catalogName, new TpchTableHandle("nation", 1.0), TpchTransactionHandle.INSTANCE, Optional.empty());
}
Aggregations