Search in sources :

Example 1 with DistinctLimitNode

use of com.facebook.presto.spi.plan.DistinctLimitNode in project presto by prestodb.

the class TestPinotQueryGenerator method testDistinctLimitPushdown.

@Test
public void testDistinctLimitPushdown() {
    PlanBuilder planBuilder = createPlanBuilder(defaultSessionHolder);
    DistinctLimitNode distinctLimitNode = distinctLimit(planBuilder, ImmutableList.of(new VariableReferenceExpression(Optional.empty(), "regionid", BIGINT)), 50L, tableScan(planBuilder, pinotTable, regionId));
    testPinotQuery(pinotConfig, distinctLimitNode, String.format("SELECT %s FROM realtimeOnly GROUP BY regionId %s 50", getExpectedDistinctOutput("regionId"), getGroupByLimitKey()), defaultSessionHolder, ImmutableMap.of());
    planBuilder = createPlanBuilder(defaultSessionHolder);
    distinctLimitNode = distinctLimit(planBuilder, ImmutableList.of(new VariableReferenceExpression(Optional.empty(), "regionid", BIGINT), new VariableReferenceExpression(Optional.empty(), "city", VARCHAR)), 50L, tableScan(planBuilder, pinotTable, regionId, city));
    testPinotQuery(pinotConfig, distinctLimitNode, String.format("SELECT %s FROM realtimeOnly GROUP BY regionId, city %s 50", getExpectedDistinctOutput("regionId, city"), getGroupByLimitKey()), defaultSessionHolder, ImmutableMap.of());
}
Also used : VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) DistinctLimitNode(com.facebook.presto.spi.plan.DistinctLimitNode) PlanBuilder(com.facebook.presto.sql.planner.iterative.rule.test.PlanBuilder) Test(org.testng.annotations.Test)

Aggregations

DistinctLimitNode (com.facebook.presto.spi.plan.DistinctLimitNode)1 VariableReferenceExpression (com.facebook.presto.spi.relation.VariableReferenceExpression)1 PlanBuilder (com.facebook.presto.sql.planner.iterative.rule.test.PlanBuilder)1 Test (org.testng.annotations.Test)1