Search in sources :

Example 1 with LimitOperatorFactory

use of com.facebook.presto.operator.LimitOperator.LimitOperatorFactory in project presto by prestodb.

the class TestLimitOperator method testLimitWithPageAlignment.

@Test
public void testLimitWithPageAlignment() {
    List<Page> input = rowPagesBuilder(BIGINT).addSequencePage(3, 1).addSequencePage(2, 4).addSequencePage(2, 6).build();
    OperatorFactory operatorFactory = new LimitOperatorFactory(0, new PlanNodeId("test"), 5);
    MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT).page(createSequencePage(ImmutableList.of(BIGINT), 3, 1)).page(createSequencePage(ImmutableList.of(BIGINT), 2, 4)).build();
    OperatorAssertion.assertOperatorEquals(operatorFactory, driverContext, input, expected);
}
Also used : PlanNodeId(com.facebook.presto.spi.plan.PlanNodeId) LimitOperatorFactory(com.facebook.presto.operator.LimitOperator.LimitOperatorFactory) LimitOperatorFactory(com.facebook.presto.operator.LimitOperator.LimitOperatorFactory) Page(com.facebook.presto.common.Page) SequencePageBuilder.createSequencePage(com.facebook.presto.SequencePageBuilder.createSequencePage) MaterializedResult(com.facebook.presto.testing.MaterializedResult) Test(org.testng.annotations.Test)

Example 2 with LimitOperatorFactory

use of com.facebook.presto.operator.LimitOperator.LimitOperatorFactory in project presto by prestodb.

the class OrderByBenchmark method createOperatorFactories.

@Override
protected List<? extends OperatorFactory> createOperatorFactories() {
    List<Type> tableScanTypes = getColumnTypes("orders", "totalprice", "clerk");
    OperatorFactory tableScanOperator = createTableScanOperator(0, new PlanNodeId("test"), "orders", "totalprice", "clerk");
    LimitOperatorFactory limitOperator = new LimitOperatorFactory(1, new PlanNodeId("test"), ROWS);
    OrderByOperatorFactory orderByOperator = new OrderByOperatorFactory(2, new PlanNodeId("test"), tableScanTypes, ImmutableList.of(1), ROWS, ImmutableList.of(0), ImmutableList.of(ASC_NULLS_LAST), new PagesIndex.TestingFactory(false), false, Optional.empty(), new OrderingCompiler());
    return ImmutableList.of(tableScanOperator, limitOperator, orderByOperator);
}
Also used : PlanNodeId(com.facebook.presto.spi.plan.PlanNodeId) Type(com.facebook.presto.common.type.Type) LimitOperatorFactory(com.facebook.presto.operator.LimitOperator.LimitOperatorFactory) OperatorFactory(com.facebook.presto.operator.OperatorFactory) LimitOperatorFactory(com.facebook.presto.operator.LimitOperator.LimitOperatorFactory) OrderByOperatorFactory(com.facebook.presto.operator.OrderByOperator.OrderByOperatorFactory) OrderByOperatorFactory(com.facebook.presto.operator.OrderByOperator.OrderByOperatorFactory) OrderingCompiler(com.facebook.presto.sql.gen.OrderingCompiler) PagesIndex(com.facebook.presto.operator.PagesIndex)

Example 3 with LimitOperatorFactory

use of com.facebook.presto.operator.LimitOperator.LimitOperatorFactory in project presto by prestodb.

the class TestLimitOperator method testLimitWithBlockView.

@Test
public void testLimitWithBlockView() {
    List<Page> input = rowPagesBuilder(BIGINT).addSequencePage(3, 1).addSequencePage(2, 4).addSequencePage(2, 6).build();
    OperatorFactory operatorFactory = new LimitOperatorFactory(0, new PlanNodeId("test"), 6);
    List<Page> expected = rowPagesBuilder(BIGINT).addSequencePage(3, 1).addSequencePage(2, 4).addSequencePage(1, 6).build();
    OperatorAssertion.assertOperatorEquals(operatorFactory, ImmutableList.of(BIGINT), driverContext, input, expected);
}
Also used : PlanNodeId(com.facebook.presto.spi.plan.PlanNodeId) LimitOperatorFactory(com.facebook.presto.operator.LimitOperator.LimitOperatorFactory) LimitOperatorFactory(com.facebook.presto.operator.LimitOperator.LimitOperatorFactory) Page(com.facebook.presto.common.Page) SequencePageBuilder.createSequencePage(com.facebook.presto.SequencePageBuilder.createSequencePage) Test(org.testng.annotations.Test)

Aggregations

LimitOperatorFactory (com.facebook.presto.operator.LimitOperator.LimitOperatorFactory)3 PlanNodeId (com.facebook.presto.spi.plan.PlanNodeId)3 SequencePageBuilder.createSequencePage (com.facebook.presto.SequencePageBuilder.createSequencePage)2 Page (com.facebook.presto.common.Page)2 Test (org.testng.annotations.Test)2 Type (com.facebook.presto.common.type.Type)1 OperatorFactory (com.facebook.presto.operator.OperatorFactory)1 OrderByOperatorFactory (com.facebook.presto.operator.OrderByOperator.OrderByOperatorFactory)1 PagesIndex (com.facebook.presto.operator.PagesIndex)1 OrderingCompiler (com.facebook.presto.sql.gen.OrderingCompiler)1 MaterializedResult (com.facebook.presto.testing.MaterializedResult)1