use of com.facebook.presto.common.PageBuilder in project presto by prestodb.
the class TestRealHistogramAggregation method makeInput.
private static Page makeInput(int numberOfBuckets) {
PageBuilder builder = new PageBuilder(ImmutableList.of(BIGINT, REAL, DOUBLE));
for (int i = 0; i < 100; i++) {
builder.declarePosition();
BIGINT.writeLong(builder.getBlockBuilder(0), numberOfBuckets);
// value
REAL.writeLong(builder.getBlockBuilder(1), i);
// weight
DOUBLE.writeDouble(builder.getBlockBuilder(2), 1);
}
return builder.build();
}
use of com.facebook.presto.common.PageBuilder in project presto by prestodb.
the class CommonSubExpressionBenchmark method ComputeRecordSet.
@Benchmark
public Optional<Page> ComputeRecordSet() {
List<Type> types = ImmutableList.of(TYPE_MAP.get(this.functionType));
PageBuilder pageBuilder = new PageBuilder(projectionTypes);
RecordSet recordSet = new PageRecordSet(types, inputPage);
cursorProcessor.process(null, new DriverYieldSignal(), recordSet.cursor(), pageBuilder);
return Optional.of(pageBuilder.build());
}
use of com.facebook.presto.common.PageBuilder in project presto by prestodb.
the class PageProcessorBenchmark method rowOriented.
@Benchmark
public Page rowOriented() {
PageBuilder pageBuilder = new PageBuilder(types);
cursorProcessor.process(null, yieldSignal, recordSet.cursor(), pageBuilder);
return pageBuilder.build();
}
use of com.facebook.presto.common.PageBuilder in project presto by prestodb.
the class TestCursorProcessorCompiler method testCompilerWithCSE.
@Test
public void testCompilerWithCSE() {
PageFunctionCompiler functionCompiler = new PageFunctionCompiler(METADATA, 0);
ExpressionCompiler expressionCompiler = new ExpressionCompiler(METADATA, functionCompiler);
RowExpression filter = new SpecialFormExpression(AND, BIGINT, ADD_X_Y_GREATER_THAN_2, ADD_X_Y_LESS_THAN_10);
List<? extends RowExpression> projections = createIfProjectionList(5);
Supplier<CursorProcessor> cseCursorProcessorSupplier = expressionCompiler.compileCursorProcessor(SESSION.getSqlFunctionProperties(), Optional.of(filter), projections, "key", true);
Supplier<CursorProcessor> noCseSECursorProcessorSupplier = expressionCompiler.compileCursorProcessor(SESSION.getSqlFunctionProperties(), Optional.of(filter), projections, "key", false);
Page input = createLongBlockPage(2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
List<Type> types = ImmutableList.of(BIGINT, BIGINT);
PageBuilder pageBuilder = new PageBuilder(projections.stream().map(RowExpression::getType).collect(toList()));
RecordSet recordSet = new PageRecordSet(types, input);
cseCursorProcessorSupplier.get().process(SESSION.getSqlFunctionProperties(), new DriverYieldSignal(), recordSet.cursor(), pageBuilder);
Page pageFromCSE = pageBuilder.build();
pageBuilder.reset();
noCseSECursorProcessorSupplier.get().process(SESSION.getSqlFunctionProperties(), new DriverYieldSignal(), recordSet.cursor(), pageBuilder);
Page pageFromNoCSE = pageBuilder.build();
checkPageEqual(pageFromCSE, pageFromNoCSE);
}
use of com.facebook.presto.common.PageBuilder in project presto by prestodb.
the class BenchmarkPageProcessor method handCoded.
@Benchmark
public Page handCoded(BenchmarkData data) {
PageBuilder pageBuilder = new PageBuilder(ImmutableList.of(DOUBLE));
int count = data.handcodedProcessor.process(data.inputPage, 0, data.inputPage.getPositionCount(), pageBuilder);
checkState(count == data.inputPage.getPositionCount());
return pageBuilder.build();
}
Aggregations