Search in sources :

Example 1 with PARTIAL

use of io.prestosql.spi.plan.AggregationNode.Step.PARTIAL in project hetu-core by openlookeng.

the class TestValidateAggregationsWithDefaultValues method testWithPartialAggregationBelowJoinWithoutSeparatingExchange.

@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Final aggregation with default value not separated from partial aggregation by local hash exchange")
public void testWithPartialAggregationBelowJoinWithoutSeparatingExchange() {
    Symbol symbolObj = new Symbol("symbol");
    PlanNode root = builder.aggregation(af -> af.step(FINAL).groupingSets(groupingSets(ImmutableList.of(symbolObj), 2, ImmutableSet.of(0))).source(builder.join(INNER, builder.aggregation(ap -> ap.step(PARTIAL).groupingSets(groupingSets(ImmutableList.of(symbolObj), 2, ImmutableSet.of(0))).source(tableScanNode)), builder.values())));
    validatePlan(root, true);
}
Also used : TpchTableHandle(io.prestosql.plugin.tpch.TpchTableHandle) TpchColumnHandle(io.prestosql.plugin.tpch.TpchColumnHandle) TypeProvider(io.prestosql.sql.planner.TypeProvider) Test(org.testng.annotations.Test) SqlParser(io.prestosql.sql.parser.SqlParser) TableHandle(io.prestosql.spi.metadata.TableHandle) PARTIAL(io.prestosql.spi.plan.AggregationNode.Step.PARTIAL) TypeAnalyzer(io.prestosql.sql.planner.TypeAnalyzer) REMOTE(io.prestosql.sql.planner.plan.ExchangeNode.Scope.REMOTE) WarningCollector(io.prestosql.execution.warnings.WarningCollector) ImmutableList(com.google.common.collect.ImmutableList) REPARTITION(io.prestosql.sql.planner.plan.ExchangeNode.Type.REPARTITION) BIGINT(io.prestosql.spi.type.BigintType.BIGINT) Symbol(io.prestosql.spi.plan.Symbol) BasePlanTest(io.prestosql.sql.planner.assertions.BasePlanTest) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) BeforeClass(org.testng.annotations.BeforeClass) CatalogName(io.prestosql.spi.connector.CatalogName) TableScanNode(io.prestosql.spi.plan.TableScanNode) PlanNode(io.prestosql.spi.plan.PlanNode) FINAL(io.prestosql.spi.plan.AggregationNode.Step.FINAL) Metadata(io.prestosql.metadata.Metadata) AggregationNode.groupingSets(io.prestosql.spi.plan.AggregationNode.groupingSets) TestingTransactionHandle(io.prestosql.testing.TestingTransactionHandle) LOCAL(io.prestosql.sql.planner.plan.ExchangeNode.Scope.LOCAL) PlanNodeIdAllocator(io.prestosql.spi.plan.PlanNodeIdAllocator) INNER(io.prestosql.spi.plan.JoinNode.Type.INNER) Optional(java.util.Optional) PlanBuilder(io.prestosql.sql.planner.iterative.rule.test.PlanBuilder) PlanNode(io.prestosql.spi.plan.PlanNode) Symbol(io.prestosql.spi.plan.Symbol) Test(org.testng.annotations.Test) BasePlanTest(io.prestosql.sql.planner.assertions.BasePlanTest)

Example 2 with PARTIAL

use of io.prestosql.spi.plan.AggregationNode.Step.PARTIAL in project hetu-core by openlookeng.

the class TestValidateAggregationsWithDefaultValues method testWithPartialAggregationBelowJoin.

@Test
public void testWithPartialAggregationBelowJoin() {
    Symbol symbolObj = new Symbol("symbol");
    PlanNode root = builder.aggregation(af -> af.step(FINAL).groupingSets(groupingSets(ImmutableList.of(symbolObj), 2, ImmutableSet.of(0))).source(builder.join(INNER, builder.exchange(e -> e.type(REPARTITION).scope(LOCAL).fixedHashDistributionParitioningScheme(ImmutableList.of(symbolObj), ImmutableList.of(symbolObj)).addInputsSet(symbolObj).addSource(builder.aggregation(ap -> ap.step(PARTIAL).groupingSets(groupingSets(ImmutableList.of(symbolObj), 2, ImmutableSet.of(0))).source(tableScanNode)))), builder.values())));
    validatePlan(root, true);
}
Also used : TpchTableHandle(io.prestosql.plugin.tpch.TpchTableHandle) TpchColumnHandle(io.prestosql.plugin.tpch.TpchColumnHandle) TypeProvider(io.prestosql.sql.planner.TypeProvider) Test(org.testng.annotations.Test) SqlParser(io.prestosql.sql.parser.SqlParser) TableHandle(io.prestosql.spi.metadata.TableHandle) PARTIAL(io.prestosql.spi.plan.AggregationNode.Step.PARTIAL) TypeAnalyzer(io.prestosql.sql.planner.TypeAnalyzer) REMOTE(io.prestosql.sql.planner.plan.ExchangeNode.Scope.REMOTE) WarningCollector(io.prestosql.execution.warnings.WarningCollector) ImmutableList(com.google.common.collect.ImmutableList) REPARTITION(io.prestosql.sql.planner.plan.ExchangeNode.Type.REPARTITION) BIGINT(io.prestosql.spi.type.BigintType.BIGINT) Symbol(io.prestosql.spi.plan.Symbol) BasePlanTest(io.prestosql.sql.planner.assertions.BasePlanTest) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) BeforeClass(org.testng.annotations.BeforeClass) CatalogName(io.prestosql.spi.connector.CatalogName) TableScanNode(io.prestosql.spi.plan.TableScanNode) PlanNode(io.prestosql.spi.plan.PlanNode) FINAL(io.prestosql.spi.plan.AggregationNode.Step.FINAL) Metadata(io.prestosql.metadata.Metadata) AggregationNode.groupingSets(io.prestosql.spi.plan.AggregationNode.groupingSets) TestingTransactionHandle(io.prestosql.testing.TestingTransactionHandle) LOCAL(io.prestosql.sql.planner.plan.ExchangeNode.Scope.LOCAL) PlanNodeIdAllocator(io.prestosql.spi.plan.PlanNodeIdAllocator) INNER(io.prestosql.spi.plan.JoinNode.Type.INNER) Optional(java.util.Optional) PlanBuilder(io.prestosql.sql.planner.iterative.rule.test.PlanBuilder) PlanNode(io.prestosql.spi.plan.PlanNode) Symbol(io.prestosql.spi.plan.Symbol) Test(org.testng.annotations.Test) BasePlanTest(io.prestosql.sql.planner.assertions.BasePlanTest)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 WarningCollector (io.prestosql.execution.warnings.WarningCollector)2 Metadata (io.prestosql.metadata.Metadata)2 TpchColumnHandle (io.prestosql.plugin.tpch.TpchColumnHandle)2 TpchTableHandle (io.prestosql.plugin.tpch.TpchTableHandle)2 CatalogName (io.prestosql.spi.connector.CatalogName)2 TableHandle (io.prestosql.spi.metadata.TableHandle)2 FINAL (io.prestosql.spi.plan.AggregationNode.Step.FINAL)2 PARTIAL (io.prestosql.spi.plan.AggregationNode.Step.PARTIAL)2 AggregationNode.groupingSets (io.prestosql.spi.plan.AggregationNode.groupingSets)2 INNER (io.prestosql.spi.plan.JoinNode.Type.INNER)2 PlanNode (io.prestosql.spi.plan.PlanNode)2 PlanNodeIdAllocator (io.prestosql.spi.plan.PlanNodeIdAllocator)2 Symbol (io.prestosql.spi.plan.Symbol)2 TableScanNode (io.prestosql.spi.plan.TableScanNode)2 BIGINT (io.prestosql.spi.type.BigintType.BIGINT)2 SqlParser (io.prestosql.sql.parser.SqlParser)2 TypeAnalyzer (io.prestosql.sql.planner.TypeAnalyzer)2