Search in sources :

Example 26 with PageProcessor

use of io.prestosql.operator.project.PageProcessor in project hetu-core by openlookeng.

the class TestFilterAndProjectOperator method testMergeOutput.

@Test
public void testMergeOutput() {
    List<Page> input = rowPagesBuilder(VARCHAR, BIGINT).addSequencePage(100, 0, 0).addSequencePage(100, 0, 0).addSequencePage(100, 0, 0).addSequencePage(100, 0, 0).build();
    RowExpression filter = call(EQUAL.getFunctionName().toString(), new BuiltInFunctionHandle(Signature.internalOperator(EQUAL, BOOLEAN.getTypeSignature(), ImmutableList.of(BIGINT.getTypeSignature(), BIGINT.getTypeSignature()))), BOOLEAN, field(1, BIGINT), constant(10L, BIGINT));
    Metadata metadata = createTestMetadataManager();
    ExpressionCompiler compiler = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0));
    Supplier<PageProcessor> processor = compiler.compilePageProcessor(Optional.of(filter), ImmutableList.of(field(1, BIGINT)));
    OperatorFactory operatorFactory = new FilterAndProjectOperator.FilterAndProjectOperatorFactory(0, new PlanNodeId("test"), processor, ImmutableList.of(BIGINT), new DataSize(64, KILOBYTE), 2);
    List<Page> expected = rowPagesBuilder(BIGINT).row(10L).row(10L).row(10L).row(10L).build();
    assertOperatorEquals(operatorFactory, ImmutableList.of(BIGINT), driverContext, input, expected);
}
Also used : PageFunctionCompiler(io.prestosql.sql.gen.PageFunctionCompiler) Metadata(io.prestosql.metadata.Metadata) RowExpression(io.prestosql.spi.relation.RowExpression) Page(io.prestosql.spi.Page) BuiltInFunctionHandle(io.prestosql.spi.function.BuiltInFunctionHandle) PlanNodeId(io.prestosql.spi.plan.PlanNodeId) PageProcessor(io.prestosql.operator.project.PageProcessor) DataSize(io.airlift.units.DataSize) ExpressionCompiler(io.prestosql.sql.gen.ExpressionCompiler) Test(org.testng.annotations.Test)

Aggregations

PageProcessor (io.prestosql.operator.project.PageProcessor)26 Page (io.prestosql.spi.Page)18 Test (org.testng.annotations.Test)18 RowExpression (io.prestosql.spi.relation.RowExpression)15 DataSize (io.airlift.units.DataSize)14 PlanNodeId (io.prestosql.spi.plan.PlanNodeId)14 BuiltInFunctionHandle (io.prestosql.spi.function.BuiltInFunctionHandle)11 PageFunctionCompiler (io.prestosql.sql.gen.PageFunctionCompiler)10 CursorProcessor (io.prestosql.operator.project.CursorProcessor)9 Metadata (io.prestosql.metadata.Metadata)7 Split (io.prestosql.metadata.Split)7 DriverYieldSignal (io.prestosql.operator.DriverYieldSignal)7 CatalogName (io.prestosql.spi.connector.CatalogName)6 ExpressionCompiler (io.prestosql.sql.gen.ExpressionCompiler)6 MaterializedResult (io.prestosql.testing.MaterializedResult)6 TestingSplit (io.prestosql.testing.TestingSplit)6 UUID (java.util.UUID)6 ImmutableList (com.google.common.collect.ImmutableList)5 FixedPageSource (io.prestosql.spi.connector.FixedPageSource)5 OperatorAssertion.toMaterializedResult (io.prestosql.operator.OperatorAssertion.toMaterializedResult)4