Search in sources :

Example 26 with ClassDefinition

use of com.facebook.presto.bytecode.ClassDefinition in project presto by prestodb.

the class AccumulatorCompiler method generateAccumulatorClass.

private static <T> Class<? extends T> generateAccumulatorClass(Class<T> accumulatorInterface, AggregationMetadata metadata, DynamicClassLoader classLoader) {
    boolean grouped = accumulatorInterface == GroupedAccumulator.class;
    ClassDefinition definition = new ClassDefinition(a(PUBLIC, FINAL), makeClassName(metadata.getName() + accumulatorInterface.getSimpleName()), type(Object.class), type(accumulatorInterface));
    CallSiteBinder callSiteBinder = new CallSiteBinder();
    List<AccumulatorStateDescriptor> stateDescriptors = metadata.getAccumulatorStateDescriptors();
    List<StateFieldAndDescriptor> stateFieldAndDescriptors = new ArrayList<>();
    for (int i = 0; i < stateDescriptors.size(); i++) {
        stateFieldAndDescriptors.add(new StateFieldAndDescriptor(definition.declareField(a(PRIVATE, FINAL), "stateSerializer_" + i, AccumulatorStateSerializer.class), definition.declareField(a(PRIVATE, FINAL), "stateFactory_" + i, AccumulatorStateFactory.class), definition.declareField(a(PRIVATE, FINAL), "state_" + i, grouped ? stateDescriptors.get(i).getFactory().getGroupedStateClass() : stateDescriptors.get(i).getFactory().getSingleStateClass()), stateDescriptors.get(i)));
    }
    List<FieldDefinition> stateFileds = stateFieldAndDescriptors.stream().map(StateFieldAndDescriptor::getStateField).collect(toImmutableList());
    int lambdaCount = metadata.getLambdaInterfaces().size();
    List<FieldDefinition> lambdaProviderFields = new ArrayList<>(lambdaCount);
    for (int i = 0; i < lambdaCount; i++) {
        lambdaProviderFields.add(definition.declareField(a(PRIVATE, FINAL), "lambdaProvider_" + i, LambdaProvider.class));
    }
    FieldDefinition maskChannelField = definition.declareField(a(PRIVATE, FINAL), "maskChannel", int.class);
    int inputChannelCount = countInputChannels(metadata.getValueInputMetadata());
    ImmutableList.Builder<FieldDefinition> inputFieldsBuilder = ImmutableList.builderWithExpectedSize(inputChannelCount);
    for (int i = 0; i < inputChannelCount; i++) {
        inputFieldsBuilder.add(definition.declareField(a(PRIVATE, FINAL), "inputChannel" + i, int.class));
    }
    List<FieldDefinition> inputChannelFields = inputFieldsBuilder.build();
    // Generate constructor
    generateConstructor(definition, stateFieldAndDescriptors, inputChannelFields, maskChannelField, lambdaProviderFields, grouped);
    // Generate methods
    generateAddInput(definition, stateFileds, inputChannelFields, maskChannelField, metadata.getValueInputMetadata(), metadata.getLambdaInterfaces(), lambdaProviderFields, metadata.getInputFunction(), callSiteBinder, grouped);
    generateAddInputWindowIndex(definition, stateFileds, metadata.getValueInputMetadata(), metadata.getLambdaInterfaces(), lambdaProviderFields, metadata.getInputFunction(), callSiteBinder);
    generateGetEstimatedSize(definition, stateFileds);
    generateGetIntermediateType(definition, callSiteBinder, stateDescriptors.stream().map(stateDescriptor -> stateDescriptor.getSerializer().getSerializedType()).collect(toImmutableList()));
    generateGetFinalType(definition, callSiteBinder, metadata.getOutputType());
    generateAddIntermediateAsCombine(definition, stateFieldAndDescriptors, metadata.getLambdaInterfaces(), lambdaProviderFields, metadata.getCombineFunction(), callSiteBinder, grouped);
    if (grouped) {
        generateGroupedEvaluateIntermediate(definition, stateFieldAndDescriptors);
    } else {
        generateEvaluateIntermediate(definition, stateFieldAndDescriptors);
    }
    if (grouped) {
        generateGroupedEvaluateFinal(definition, stateFileds, metadata.getOutputFunction(), callSiteBinder);
    } else {
        generateEvaluateFinal(definition, stateFileds, metadata.getOutputFunction(), callSiteBinder);
    }
    if (grouped) {
        generatePrepareFinal(definition);
    }
    return defineClass(definition, accumulatorInterface, callSiteBinder.getBindings(), classLoader);
}
Also used : AccumulatorStateDescriptor(com.facebook.presto.operator.aggregation.AggregationMetadata.AccumulatorStateDescriptor) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) ImmutableList(com.google.common.collect.ImmutableList) FieldDefinition(com.facebook.presto.bytecode.FieldDefinition) ArrayList(java.util.ArrayList) ClassDefinition(com.facebook.presto.bytecode.ClassDefinition) CallSiteBinder(com.facebook.presto.bytecode.CallSiteBinder)

Example 27 with ClassDefinition

use of com.facebook.presto.bytecode.ClassDefinition in project presto by prestodb.

the class ExpressionCompiler method compileProcessor.

private <T> Class<? extends T> compileProcessor(SqlFunctionProperties sqlFunctionProperties, RowExpression filter, List<RowExpression> projections, BodyCompiler bodyCompiler, Class<? extends T> superType) {
    ClassDefinition classDefinition = new ClassDefinition(a(PUBLIC, FINAL), makeClassName(superType.getSimpleName()), type(Object.class), type(superType));
    CallSiteBinder callSiteBinder = new CallSiteBinder();
    bodyCompiler.generateMethods(sqlFunctionProperties, classDefinition, callSiteBinder, filter, projections);
    // 
    // toString method
    // 
    generateToString(classDefinition, callSiteBinder, toStringHelper(classDefinition.getType().getJavaClassName()).add("filter", filter).add("projections", projections).toString());
    return defineClass(classDefinition, superType, callSiteBinder.getBindings(), getClass().getClassLoader());
}
Also used : CallSiteBinder(com.facebook.presto.bytecode.CallSiteBinder) ClassDefinition(com.facebook.presto.bytecode.ClassDefinition)

Example 28 with ClassDefinition

use of com.facebook.presto.bytecode.ClassDefinition in project presto by prestodb.

the class MapTransformValueFunction method generateTransform.

private static MethodHandle generateTransform(Type keyType, Type valueType, Type transformedValueType, Type resultMapType) {
    CallSiteBinder binder = new CallSiteBinder();
    Class<?> keyJavaType = Primitives.wrap(keyType.getJavaType());
    Class<?> valueJavaType = Primitives.wrap(valueType.getJavaType());
    Class<?> transformedValueJavaType = Primitives.wrap(transformedValueType.getJavaType());
    ClassDefinition definition = new ClassDefinition(a(PUBLIC, FINAL), makeClassName("MapTransformValue"), type(Object.class));
    definition.declareDefaultConstructor(a(PRIVATE));
    // define transform method
    Parameter state = arg("state", Object.class);
    Parameter block = arg("block", Block.class);
    Parameter function = arg("function", BinaryFunctionInterface.class);
    MethodDefinition method = definition.declareMethod(a(PUBLIC, STATIC), "transform", type(Block.class), ImmutableList.of(state, block, function));
    BytecodeBlock body = method.getBody();
    Scope scope = method.getScope();
    Variable positionCount = scope.declareVariable(int.class, "positionCount");
    Variable position = scope.declareVariable(int.class, "position");
    Variable pageBuilder = scope.declareVariable(PageBuilder.class, "pageBuilder");
    Variable mapBlockBuilder = scope.declareVariable(BlockBuilder.class, "mapBlockBuilder");
    Variable blockBuilder = scope.declareVariable(BlockBuilder.class, "blockBuilder");
    Variable keyElement = scope.declareVariable(keyJavaType, "keyElement");
    Variable valueElement = scope.declareVariable(valueJavaType, "valueElement");
    Variable transformedValueElement = scope.declareVariable(transformedValueJavaType, "transformedValueElement");
    // invoke block.getPositionCount()
    body.append(positionCount.set(block.invoke("getPositionCount", int.class)));
    // prepare the single map block builder
    body.append(pageBuilder.set(state.cast(PageBuilder.class)));
    body.append(new IfStatement().condition(pageBuilder.invoke("isFull", boolean.class)).ifTrue(pageBuilder.invoke("reset", void.class)));
    body.append(mapBlockBuilder.set(pageBuilder.invoke("getBlockBuilder", BlockBuilder.class, constantInt(0))));
    body.append(blockBuilder.set(mapBlockBuilder.invoke("beginBlockEntry", BlockBuilder.class)));
    // throw null key exception block
    BytecodeNode throwNullKeyException = new BytecodeBlock().append(newInstance(PrestoException.class, getStatic(INVALID_FUNCTION_ARGUMENT.getDeclaringClass(), "INVALID_FUNCTION_ARGUMENT").cast(ErrorCodeSupplier.class), constantString("map key cannot be null"))).throwObject();
    SqlTypeBytecodeExpression keySqlType = constantType(binder, keyType);
    BytecodeNode loadKeyElement;
    if (!keyType.equals(UNKNOWN)) {
        loadKeyElement = new BytecodeBlock().append(keyElement.set(keySqlType.getValue(block, position).cast(keyJavaType)));
    } else {
        // make sure invokeExact will not take uninitialized keys during compile time
        // but if we reach this point during runtime, it is an exception
        // also close the block builder before throwing as we may be in a TRY() call
        // so that subsequent calls do not find it in an inconsistent state
        loadKeyElement = new BytecodeBlock().append(mapBlockBuilder.invoke("closeEntry", BlockBuilder.class).pop()).append(keyElement.set(constantNull(keyJavaType))).append(throwNullKeyException);
    }
    SqlTypeBytecodeExpression valueSqlType = constantType(binder, valueType);
    BytecodeNode loadValueElement;
    if (!valueType.equals(UNKNOWN)) {
        loadValueElement = new IfStatement().condition(block.invoke("isNull", boolean.class, add(position, constantInt(1)))).ifTrue(valueElement.set(constantNull(valueJavaType))).ifFalse(valueElement.set(valueSqlType.getValue(block, add(position, constantInt(1))).cast(valueJavaType)));
    } else {
        loadValueElement = new BytecodeBlock().append(valueElement.set(constantNull(valueJavaType)));
    }
    BytecodeNode writeTransformedValueElement;
    if (!transformedValueType.equals(UNKNOWN)) {
        writeTransformedValueElement = new IfStatement().condition(equal(transformedValueElement, constantNull(transformedValueJavaType))).ifTrue(blockBuilder.invoke("appendNull", BlockBuilder.class).pop()).ifFalse(constantType(binder, transformedValueType).writeValue(blockBuilder, transformedValueElement.cast(transformedValueType.getJavaType())));
    } else {
        writeTransformedValueElement = new BytecodeBlock().append(blockBuilder.invoke("appendNull", BlockBuilder.class).pop());
    }
    Variable transformationException = scope.declareVariable(Throwable.class, "transformationException");
    body.append(new ForLoop().initialize(position.set(constantInt(0))).condition(lessThan(position, positionCount)).update(incrementVariable(position, (byte) 2)).body(new BytecodeBlock().append(loadKeyElement).append(loadValueElement).append(new TryCatch("Close builder before throwing to avoid subsequent calls finding it in an inconsistent state if we are in in a TRY() call.", transformedValueElement.set(function.invoke("apply", Object.class, keyElement.cast(Object.class), valueElement.cast(Object.class)).cast(transformedValueJavaType)), new BytecodeBlock().append(mapBlockBuilder.invoke("closeEntry", BlockBuilder.class).pop()).append(pageBuilder.invoke("declarePosition", void.class)).putVariable(transformationException).append(invokeStatic(Throwables.class, "throwIfUnchecked", void.class, transformationException)).append(newInstance(RuntimeException.class, transformationException)).throwObject(), type(Throwable.class))).append(keySqlType.invoke("appendTo", void.class, block, position, blockBuilder)).append(writeTransformedValueElement)));
    body.append(mapBlockBuilder.invoke("closeEntry", BlockBuilder.class).pop());
    body.append(pageBuilder.invoke("declarePosition", void.class));
    body.append(constantType(binder, resultMapType).invoke("getObject", Object.class, mapBlockBuilder.cast(Block.class), subtract(mapBlockBuilder.invoke("getPositionCount", int.class), constantInt(1))).ret());
    Class<?> generatedClass = defineClass(definition, Object.class, binder.getBindings(), MapTransformValueFunction.class.getClassLoader());
    return methodHandle(generatedClass, "transform", Object.class, Block.class, BinaryFunctionInterface.class);
}
Also used : TryCatch(com.facebook.presto.bytecode.control.TryCatch) Signature.typeVariable(com.facebook.presto.spi.function.Signature.typeVariable) Variable(com.facebook.presto.bytecode.Variable) VariableInstruction.incrementVariable(com.facebook.presto.bytecode.instruction.VariableInstruction.incrementVariable) ErrorCodeSupplier(com.facebook.presto.spi.ErrorCodeSupplier) ForLoop(com.facebook.presto.bytecode.control.ForLoop) Throwables(com.google.common.base.Throwables) BytecodeBlock(com.facebook.presto.bytecode.BytecodeBlock) ClassDefinition(com.facebook.presto.bytecode.ClassDefinition) IfStatement(com.facebook.presto.bytecode.control.IfStatement) Scope(com.facebook.presto.bytecode.Scope) MethodDefinition(com.facebook.presto.bytecode.MethodDefinition) CallSiteBinder(com.facebook.presto.bytecode.CallSiteBinder) Parameter(com.facebook.presto.bytecode.Parameter) TypeSignatureParameter(com.facebook.presto.common.type.TypeSignatureParameter) BytecodeBlock(com.facebook.presto.bytecode.BytecodeBlock) Block(com.facebook.presto.common.block.Block) BytecodeNode(com.facebook.presto.bytecode.BytecodeNode) SqlTypeBytecodeExpression(com.facebook.presto.sql.gen.SqlTypeBytecodeExpression) BlockBuilder(com.facebook.presto.common.block.BlockBuilder)

Example 29 with ClassDefinition

use of com.facebook.presto.bytecode.ClassDefinition in project presto by prestodb.

the class MapFilterFunction method mapFilter.

@CodegenScalarFunction(value = "map_filter", deterministic = false)
@Description("return map containing entries that match the given predicate")
@TypeParameter("K")
@TypeParameter("V")
@SqlType("map(K,V)")
public static MethodHandle mapFilter(@SqlType("map(K,V)") Type inputType, @SqlType("function(K,V,boolean)") Type filter) {
    MapType mapType = (MapType) inputType;
    CallSiteBinder binder = new CallSiteBinder();
    Type keyType = mapType.getKeyType();
    Type valueType = mapType.getValueType();
    Class<?> keyJavaType = Primitives.wrap(keyType.getJavaType());
    Class<?> valueJavaType = Primitives.wrap(valueType.getJavaType());
    ClassDefinition definition = new ClassDefinition(a(PUBLIC, FINAL), makeClassName("MapFilter"), type(Object.class));
    definition.declareDefaultConstructor(a(PRIVATE));
    Parameter block = arg("block", Block.class);
    Parameter function = arg("function", BinaryFunctionInterface.class);
    MethodDefinition method = definition.declareMethod(a(PUBLIC, STATIC), "filter", type(Block.class), ImmutableList.of(block, function));
    BytecodeBlock body = method.getBody();
    Scope scope = method.getScope();
    Variable positionCount = scope.declareVariable(int.class, "positionCount");
    Variable position = scope.declareVariable(int.class, "position");
    Variable mapBlockBuilder = scope.declareVariable(BlockBuilder.class, "mapBlockBuilder");
    Variable singleMapBlockWriter = scope.declareVariable(BlockBuilder.class, "singleMapBlockWriter");
    Variable keyElement = scope.declareVariable(keyJavaType, "keyElement");
    Variable valueElement = scope.declareVariable(valueJavaType, "valueElement");
    Variable keep = scope.declareVariable(Boolean.class, "keep");
    // invoke block.getPositionCount()
    body.append(positionCount.set(block.invoke("getPositionCount", int.class)));
    // prepare the single map block builder
    body.append(mapBlockBuilder.set(constantType(binder, mapType).invoke("createBlockBuilder", BlockBuilder.class, constantNull(BlockBuilderStatus.class), constantInt(0))));
    body.append(singleMapBlockWriter.set(mapBlockBuilder.invoke("beginBlockEntry", BlockBuilder.class)));
    SqlTypeBytecodeExpression keySqlType = constantType(binder, keyType);
    BytecodeNode loadKeyElement;
    if (!keyType.equals(UNKNOWN)) {
        // key element must be non-null
        loadKeyElement = new BytecodeBlock().append(keyElement.set(keySqlType.getValue(block, position).cast(keyJavaType)));
    } else {
        loadKeyElement = new BytecodeBlock().append(keyElement.set(constantNull(keyJavaType)));
    }
    SqlTypeBytecodeExpression valueSqlType = constantType(binder, valueType);
    BytecodeNode loadValueElement;
    if (!valueType.equals(UNKNOWN)) {
        loadValueElement = new IfStatement().condition(block.invoke("isNull", boolean.class, add(position, constantInt(1)))).ifTrue(valueElement.set(constantNull(valueJavaType))).ifFalse(valueElement.set(valueSqlType.getValue(block, add(position, constantInt(1))).cast(valueJavaType)));
    } else {
        loadValueElement = new BytecodeBlock().append(valueElement.set(constantNull(valueJavaType)));
    }
    body.append(new ForLoop().initialize(position.set(constantInt(0))).condition(lessThan(position, positionCount)).update(incrementVariable(position, (byte) 2)).body(new BytecodeBlock().append(loadKeyElement).append(loadValueElement).append(keep.set(function.invoke("apply", Object.class, keyElement.cast(Object.class), valueElement.cast(Object.class)).cast(Boolean.class))).append(new IfStatement("if (keep != null && keep) ...").condition(and(notEqual(keep, constantNull(Boolean.class)), keep.cast(boolean.class))).ifTrue(new BytecodeBlock().append(keySqlType.invoke("appendTo", void.class, block, position, singleMapBlockWriter)).append(valueSqlType.invoke("appendTo", void.class, block, add(position, constantInt(1)), singleMapBlockWriter))))));
    body.append(mapBlockBuilder.invoke("closeEntry", BlockBuilder.class).pop());
    body.append(constantType(binder, mapType).invoke("getObject", Object.class, mapBlockBuilder.cast(Block.class), subtract(mapBlockBuilder.invoke("getPositionCount", int.class), constantInt(1))).ret());
    Class<?> generatedClass = defineClass(definition, Object.class, binder.getBindings(), MapFilterFunction.class.getClassLoader());
    return methodHandle(generatedClass, "filter", Block.class, BinaryFunctionInterface.class);
}
Also used : Variable(com.facebook.presto.bytecode.Variable) VariableInstruction.incrementVariable(com.facebook.presto.bytecode.instruction.VariableInstruction.incrementVariable) ForLoop(com.facebook.presto.bytecode.control.ForLoop) BytecodeBlock(com.facebook.presto.bytecode.BytecodeBlock) ClassDefinition(com.facebook.presto.bytecode.ClassDefinition) MapType(com.facebook.presto.common.type.MapType) IfStatement(com.facebook.presto.bytecode.control.IfStatement) MapType(com.facebook.presto.common.type.MapType) Type(com.facebook.presto.common.type.Type) SqlTypeBytecodeExpression.constantType(com.facebook.presto.sql.gen.SqlTypeBytecodeExpression.constantType) SqlType(com.facebook.presto.spi.function.SqlType) Scope(com.facebook.presto.bytecode.Scope) MethodDefinition(com.facebook.presto.bytecode.MethodDefinition) CallSiteBinder(com.facebook.presto.bytecode.CallSiteBinder) TypeParameter(com.facebook.presto.spi.function.TypeParameter) Parameter(com.facebook.presto.bytecode.Parameter) BytecodeBlock(com.facebook.presto.bytecode.BytecodeBlock) Block(com.facebook.presto.common.block.Block) BytecodeNode(com.facebook.presto.bytecode.BytecodeNode) BlockBuilderStatus(com.facebook.presto.common.block.BlockBuilderStatus) SqlTypeBytecodeExpression(com.facebook.presto.sql.gen.SqlTypeBytecodeExpression) TypeParameter(com.facebook.presto.spi.function.TypeParameter) Description(com.facebook.presto.spi.function.Description) CodegenScalarFunction(com.facebook.presto.spi.function.CodegenScalarFunction) SqlType(com.facebook.presto.spi.function.SqlType)

Example 30 with ClassDefinition

use of com.facebook.presto.bytecode.ClassDefinition in project presto by prestodb.

the class TestCursorProcessorCompiler method testRewriteRowExpressionWithCSE.

@Test
public void testRewriteRowExpressionWithCSE() {
    CursorProcessorCompiler cseCursorCompiler = new CursorProcessorCompiler(METADATA, true, emptyMap());
    ClassDefinition cursorProcessorClassDefinition = new ClassDefinition(a(PUBLIC, FINAL), makeClassName(CursorProcessor.class.getSimpleName()), type(Object.class), type(CursorProcessor.class));
    RowExpression filter = new SpecialFormExpression(AND, BIGINT, ADD_X_Y_GREATER_THAN_2);
    List<RowExpression> projections = ImmutableList.of(ADD_X_Y_Z);
    List<RowExpression> rowExpressions = ImmutableList.<RowExpression>builder().addAll(projections).add(filter).build();
    Map<Integer, Map<RowExpression, VariableReferenceExpression>> commonSubExpressionsByLevel = collectCSEByLevel(rowExpressions);
    Map<VariableReferenceExpression, CommonSubExpressionRewriter.CommonSubExpressionFields> cseFields = declareCommonSubExpressionFields(cursorProcessorClassDefinition, commonSubExpressionsByLevel);
    Map<RowExpression, VariableReferenceExpression> commonSubExpressions = commonSubExpressionsByLevel.values().stream().flatMap(m -> m.entrySet().stream()).collect(toImmutableMap(Map.Entry::getKey, Map.Entry::getValue));
    // X+Y as CSE
    assertEquals(1, cseFields.size());
    VariableReferenceExpression cseVariable = cseFields.keySet().iterator().next();
    RowExpression rewrittenFilter = cseCursorCompiler.rewriteRowExpressionsWithCSE(ImmutableList.of(filter), commonSubExpressions).get(0);
    List<RowExpression> rewrittenProjections = cseCursorCompiler.rewriteRowExpressionsWithCSE(projections, commonSubExpressions);
    // X+Y+Z contains CSE X+Y
    assertTrue(((CallExpression) rewrittenProjections.get(0)).getArguments().contains(cseVariable));
    // X+Y > 2 consists CSE X+Y
    assertTrue(((CallExpression) ((SpecialFormExpression) rewrittenFilter).getArguments().get(0)).getArguments().contains(cseVariable));
}
Also used : FunctionAndTypeManager(com.facebook.presto.metadata.FunctionAndTypeManager) Page(com.facebook.presto.common.Page) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) Test(org.testng.annotations.Test) Expressions.constant(com.facebook.presto.sql.relational.Expressions.constant) PageBuilder(com.facebook.presto.common.PageBuilder) Expressions.field(com.facebook.presto.sql.relational.Expressions.field) ADD(com.facebook.presto.common.function.OperatorType.ADD) Access.a(com.facebook.presto.bytecode.Access.a) CursorProcessor(com.facebook.presto.operator.project.CursorProcessor) ParameterizedType.type(com.facebook.presto.bytecode.ParameterizedType.type) IF(com.facebook.presto.spi.relation.SpecialFormExpression.Form.IF) CommonSubExpressionRewriter.collectCSEByLevel(com.facebook.presto.sql.gen.CommonSubExpressionRewriter.collectCSEByLevel) SESSION(com.facebook.presto.testing.TestingConnectorSession.SESSION) Map(java.util.Map) AND(com.facebook.presto.spi.relation.SpecialFormExpression.Form.AND) LESS_THAN(com.facebook.presto.common.function.OperatorType.LESS_THAN) CompilerUtils.makeClassName(com.facebook.presto.util.CompilerUtils.makeClassName) CallExpression(com.facebook.presto.spi.relation.CallExpression) SpecialFormExpression(com.facebook.presto.spi.relation.SpecialFormExpression) BlockBuilder(com.facebook.presto.common.block.BlockBuilder) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) ClassDefinition(com.facebook.presto.bytecode.ClassDefinition) List(java.util.List) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap) FINAL(com.facebook.presto.bytecode.Access.FINAL) Optional(java.util.Optional) IntStream(java.util.stream.IntStream) DriverYieldSignal(com.facebook.presto.operator.DriverYieldSignal) Assert.assertEquals(org.testng.Assert.assertEquals) PageRecordSet(com.facebook.presto.operator.index.PageRecordSet) Supplier(java.util.function.Supplier) TypeSignatureProvider.fromTypes(com.facebook.presto.sql.analyzer.TypeSignatureProvider.fromTypes) Expressions.call(com.facebook.presto.sql.relational.Expressions.call) ImmutableList(com.google.common.collect.ImmutableList) BOOLEAN(com.facebook.presto.common.type.BooleanType.BOOLEAN) CommonSubExpressionFields.declareCommonSubExpressionFields(com.facebook.presto.sql.gen.CommonSubExpressionRewriter.CommonSubExpressionFields.declareCommonSubExpressionFields) Type(com.facebook.presto.common.type.Type) RowExpression(com.facebook.presto.spi.relation.RowExpression) PUBLIC(com.facebook.presto.bytecode.Access.PUBLIC) BIGINT(com.facebook.presto.common.type.BigintType.BIGINT) Collections.emptyMap(java.util.Collections.emptyMap) RecordSet(com.facebook.presto.spi.RecordSet) GREATER_THAN(com.facebook.presto.common.function.OperatorType.GREATER_THAN) Collectors.toList(java.util.stream.Collectors.toList) MetadataManager.createTestMetadataManager(com.facebook.presto.metadata.MetadataManager.createTestMetadataManager) Assert.assertTrue(org.testng.Assert.assertTrue) Block(com.facebook.presto.common.block.Block) Metadata(com.facebook.presto.metadata.Metadata) CursorProcessor(com.facebook.presto.operator.project.CursorProcessor) RowExpression(com.facebook.presto.spi.relation.RowExpression) ClassDefinition(com.facebook.presto.bytecode.ClassDefinition) CommonSubExpressionFields.declareCommonSubExpressionFields(com.facebook.presto.sql.gen.CommonSubExpressionRewriter.CommonSubExpressionFields.declareCommonSubExpressionFields) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) SpecialFormExpression(com.facebook.presto.spi.relation.SpecialFormExpression) Map(java.util.Map) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap) Collections.emptyMap(java.util.Collections.emptyMap) CallExpression(com.facebook.presto.spi.relation.CallExpression) Test(org.testng.annotations.Test)

Aggregations

ClassDefinition (com.facebook.presto.bytecode.ClassDefinition)45 CallSiteBinder (com.facebook.presto.bytecode.CallSiteBinder)27 MethodDefinition (com.facebook.presto.bytecode.MethodDefinition)26 BytecodeBlock (com.facebook.presto.bytecode.BytecodeBlock)25 Parameter (com.facebook.presto.bytecode.Parameter)23 Variable (com.facebook.presto.bytecode.Variable)21 Scope (com.facebook.presto.bytecode.Scope)19 ImmutableList (com.google.common.collect.ImmutableList)18 List (java.util.List)14 IfStatement (com.facebook.presto.bytecode.control.IfStatement)13 Block (com.facebook.presto.common.block.Block)11 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)11 BytecodeNode (com.facebook.presto.bytecode.BytecodeNode)10 FieldDefinition (com.facebook.presto.bytecode.FieldDefinition)10 BlockBuilder (com.facebook.presto.common.block.BlockBuilder)9 Type (com.facebook.presto.common.type.Type)9 PrestoException (com.facebook.presto.spi.PrestoException)9 PUBLIC (com.facebook.presto.bytecode.Access.PUBLIC)8 Access.a (com.facebook.presto.bytecode.Access.a)8 ParameterizedType.type (com.facebook.presto.bytecode.ParameterizedType.type)8