use of io.prestosql.operator.project.PageProcessor in project hetu-core by openlookeng.
the class DynamicTupleFilterFactory method filterWithTuple.
public OperatorFactory filterWithTuple(Page tuplePage) {
Page filterTuple = getFilterTuple(tuplePage);
Supplier<PageProcessor> processor = createPageProcessor(filterTuple, OptionalInt.empty());
return new FilterAndProjectOperatorFactory(filterOperatorId, planNodeId, processor, outputTypes, new DataSize(0, BYTE), 0);
}
use of io.prestosql.operator.project.PageProcessor in project hetu-core by openlookeng.
the class FunctionAssertions method compileScanFilterProject.
private static SourceOperatorFactory compileScanFilterProject(Optional<RowExpression> filter, RowExpression projection, ExpressionCompiler compiler) {
try {
Supplier<CursorProcessor> cursorProcessor = compiler.compileCursorProcessor(filter, ImmutableList.of(projection), SOURCE_ID);
Supplier<PageProcessor> pageProcessor = compiler.compilePageProcessor(filter, ImmutableList.of(projection));
return new ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory(0, new PlanNodeId("test"), SOURCE_ID, PAGE_SOURCE_PROVIDER, cursorProcessor, pageProcessor, TEST_TABLE_HANDLE, ImmutableList.of(), null, ImmutableList.of(projection.getType()), new DataSize(0, BYTE), 0, ReuseExchangeOperator.STRATEGY.REUSE_STRATEGY_DEFAULT, new UUID(0, 0), false, Optional.empty(), 0, 0);
} catch (Throwable e) {
if (e instanceof UncheckedExecutionException) {
e = e.getCause();
}
throw new RuntimeException("Error compiling filter " + filter + ": " + e.getMessage(), e);
}
}
use of io.prestosql.operator.project.PageProcessor in project hetu-core by openlookeng.
the class TestPageProcessorCompiler method testSanityRLE.
@Test
public void testSanityRLE() {
PageProcessor processor = compiler.compilePageProcessor(Optional.empty(), ImmutableList.of(field(0, BIGINT), field(1, VARCHAR)), MAX_BATCH_SIZE).get();
Slice varcharValue = Slices.utf8Slice("hello");
Page page = new Page(RunLengthEncodedBlock.create(BIGINT, 123L, 100), RunLengthEncodedBlock.create(VARCHAR, varcharValue, 100));
Page outputPage = getOnlyElement(processor.process(null, new DriverYieldSignal(), newSimpleAggregatedMemoryContext().newLocalMemoryContext(PageProcessor.class.getSimpleName()), page)).orElseThrow(() -> new AssertionError("page is not present"));
assertEquals(outputPage.getPositionCount(), 100);
assertTrue(outputPage.getBlock(0) instanceof RunLengthEncodedBlock);
assertTrue(outputPage.getBlock(1) instanceof RunLengthEncodedBlock);
RunLengthEncodedBlock rleBlock = (RunLengthEncodedBlock) outputPage.getBlock(0);
assertEquals(BIGINT.getLong(rleBlock.getValue(), 0), 123L);
RunLengthEncodedBlock rleBlock1 = (RunLengthEncodedBlock) outputPage.getBlock(1);
assertEquals(VARCHAR.getSlice(rleBlock1.getValue(), 0), varcharValue);
}
use of io.prestosql.operator.project.PageProcessor in project hetu-core by openlookeng.
the class TestPageProcessorCompiler method testSanityColumnarDictionary.
@Test
public void testSanityColumnarDictionary() {
PageProcessor processor = compiler.compilePageProcessor(Optional.empty(), ImmutableList.of(field(0, VARCHAR)), MAX_BATCH_SIZE).get();
Page page = new Page(createDictionaryBlock(createExpectedValues(10), 100));
Page outputPage = getOnlyElement(processor.process(null, new DriverYieldSignal(), newSimpleAggregatedMemoryContext().newLocalMemoryContext(PageProcessor.class.getSimpleName()), page)).orElseThrow(() -> new AssertionError("page is not present"));
assertEquals(outputPage.getPositionCount(), 100);
assertTrue(outputPage.getBlock(0) instanceof DictionaryBlock);
DictionaryBlock dictionaryBlock = (DictionaryBlock) outputPage.getBlock(0);
assertEquals(dictionaryBlock.getDictionary().getPositionCount(), 10);
}
use of io.prestosql.operator.project.PageProcessor in project hetu-core by openlookeng.
the class TestPageProcessorCompiler method testSanityFilterOnRLE.
@Test
public void testSanityFilterOnRLE() {
Signature lessThan = internalOperator(LESS_THAN, BOOLEAN, ImmutableList.of(BIGINT, BIGINT));
CallExpression filter = new CallExpression(lessThan.getName().getObjectName(), new BuiltInFunctionHandle(lessThan), BOOLEAN, ImmutableList.of(field(0, BIGINT), constant(10L, BIGINT)), Optional.empty());
PageProcessor processor = compiler.compilePageProcessor(Optional.of(filter), ImmutableList.of(field(0, BIGINT)), MAX_BATCH_SIZE).get();
Page page = new Page(createRLEBlock(5L, 100));
Page outputPage = getOnlyElement(processor.process(null, new DriverYieldSignal(), newSimpleAggregatedMemoryContext().newLocalMemoryContext(PageProcessor.class.getSimpleName()), page)).orElseThrow(() -> new AssertionError("page is not present"));
assertEquals(outputPage.getPositionCount(), 100);
assertTrue(outputPage.getBlock(0) instanceof RunLengthEncodedBlock);
RunLengthEncodedBlock rle = (RunLengthEncodedBlock) outputPage.getBlock(0);
assertEquals(BIGINT.getLong(rle.getValue(), 0), 5L);
}
Aggregations