Search in sources :

Example 1 with REPARTITION

use of io.trino.sql.planner.plan.ExchangeNode.Type.REPARTITION in project trino by trinodb.

the class TestValidateAggregationsWithDefaultValues method testWithPartialAggregationBelowJoin.

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

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 TEST_SESSION (io.trino.SessionTestUtils.TEST_SESSION)1 CatalogName (io.trino.connector.CatalogName)1 WarningCollector (io.trino.execution.warnings.WarningCollector)1 TableHandle (io.trino.metadata.TableHandle)1 TpchColumnHandle (io.trino.plugin.tpch.TpchColumnHandle)1 TpchTableHandle (io.trino.plugin.tpch.TpchTableHandle)1 BIGINT (io.trino.spi.type.BigintType.BIGINT)1 PlannerContext (io.trino.sql.PlannerContext)1 PlanNodeIdAllocator (io.trino.sql.planner.PlanNodeIdAllocator)1 Symbol (io.trino.sql.planner.Symbol)1 TypeAnalyzer.createTestingTypeAnalyzer (io.trino.sql.planner.TypeAnalyzer.createTestingTypeAnalyzer)1 TypeProvider (io.trino.sql.planner.TypeProvider)1 BasePlanTest (io.trino.sql.planner.assertions.BasePlanTest)1 PlanBuilder (io.trino.sql.planner.iterative.rule.test.PlanBuilder)1 FINAL (io.trino.sql.planner.plan.AggregationNode.Step.FINAL)1 PARTIAL (io.trino.sql.planner.plan.AggregationNode.Step.PARTIAL)1 AggregationNode.groupingSets (io.trino.sql.planner.plan.AggregationNode.groupingSets)1