Search in sources :

Example 1 with ConstantPageProjection

use of com.facebook.presto.operator.project.ConstantPageProjection in project presto by prestodb.

the class PageFunctionCompiler method compileProjection.

private Supplier<PageProjection> compileProjection(SqlFunctionProperties sqlFunctionProperties, Map<SqlFunctionId, SqlInvokedFunction> sessionFunctions, RowExpression projection, Optional<String> classNameSuffix) {
    if (projection instanceof InputReferenceExpression) {
        InputReferenceExpression input = (InputReferenceExpression) projection;
        InputPageProjection projectionFunction = new InputPageProjection(input.getField());
        return () -> projectionFunction;
    }
    if (projection instanceof ConstantExpression) {
        ConstantExpression constant = (ConstantExpression) projection;
        ConstantPageProjection projectionFunction = new ConstantPageProjection(constant.getValue(), constant.getType());
        return () -> projectionFunction;
    }
    return compileProjectionCached(sqlFunctionProperties, sessionFunctions, ImmutableList.of(projection), false, classNameSuffix);
}
Also used : InputReferenceExpression(com.facebook.presto.spi.relation.InputReferenceExpression) InputPageProjection(com.facebook.presto.operator.project.InputPageProjection) ConstantPageProjection(com.facebook.presto.operator.project.ConstantPageProjection) ConstantExpression(com.facebook.presto.spi.relation.ConstantExpression)

Aggregations

ConstantPageProjection (com.facebook.presto.operator.project.ConstantPageProjection)1 InputPageProjection (com.facebook.presto.operator.project.InputPageProjection)1 ConstantExpression (com.facebook.presto.spi.relation.ConstantExpression)1 InputReferenceExpression (com.facebook.presto.spi.relation.InputReferenceExpression)1