Package com.facebook.presto.byteCode

Examples of com.facebook.presto.byteCode.Block.comment()


                .invokeConstructor(BlockBuilderStatus.class)
                .invokeInterface(Type.class, "createBlockBuilder", BlockBuilder.class, BlockBuilderStatus.class)
                .putVariable("out");

        if (outputFunction != null) {
            body.comment("output(state, out)")
                    .pushThis()
                    .getField(stateField);
            if (approximate) {
                body.pushThis().getField(confidenceField);
            }
View Full Code Here


            body.getVariable("out")
                    .invokeStatic(outputFunction);
        }
        else {
            checkArgument(!approximate, "Approximate aggregations must specify an output function");
            body.comment("stateSerializer.serialize(state, out)")
                    .pushThis()
                    .getField(stateSerializerField)
                    .pushThis()
                    .getField(stateField)
                    .getVariable("out")
View Full Code Here

        }
        else {
            createState = "createSingleState";
        }

        body.comment("this.confidence = confidence")
                .pushThis()
                .getVariable("confidence")
                .putField(confidenceField)
                .comment("this.state = stateFactory.%s()", createState)
                .pushThis()
View Full Code Here

        Object value = constant.getValue();
        Class<?> javaType = constant.getType().getJavaType();

        Block block = new Block(context);
        if (value == null) {
            return block.comment("constant null")
                    .putVariable("wasNull", true)
                    .pushJavaDefault(javaType);
        }

        // use LDC for primitives (boolean, short, int, long, float, double)
View Full Code Here

                    .putVariable("wasNull", true)
                    .pushJavaDefault(javaType);
        }

        // use LDC for primitives (boolean, short, int, long, float, double)
        block.comment("constant " + constant.getType().getName());
        if (javaType == boolean.class) {
            return block.append(loadBoolean((Boolean) value));
        }
        if (javaType == byte.class || javaType == short.class || javaType == int.class) {
            return block.append(loadInt(((Number) value).intValue()));
View Full Code Here

                .getBody()
                .comment("super();")
                .pushThis()
                .invokeConstructor(Object.class);

        constructor.comment("Set channel fields");
        for (int index = 0; index < channelFields.size(); index++) {
            ByteCodeExpression channel = compilerContext.getVariable("channels")
                    .invoke("get", Object.class, constantInt(index))
                    .cast(type(List.class, com.facebook.presto.spi.block.Block.class));
View Full Code Here

                    .cast(type(List.class, com.facebook.presto.spi.block.Block.class));

            constructor.append(compilerContext.getVariable("this").setField(channelFields.get(index), channel));
        }

        constructor.comment("Set join channel fields");
        for (int index = 0; index < joinChannelFields.size(); index++) {
            ByteCodeExpression joinChannel = compilerContext.getVariable("channels")
                    .invoke("get", Object.class, constantInt(joinChannels.get(index)))
                    .cast(type(List.class, com.facebook.presto.spi.block.Block.class));
View Full Code Here

                    .getVariable("this")
                    .getField(channelFields.get(index))
                    .invoke("get", Object.class, compilerContext.getVariable("blockIndex"))
                    .cast(com.facebook.presto.spi.block.Block.class);

            appendToBody
                    .comment("%s.appendTo(channel_%s.get(blockIndex), blockPosition, pageBuilder.getBlockBuilder(outputChannelOffset + %s));", type.getClass(), index, index)
                    .append(typeExpression)
                    .append(block)
                    .getVariable("blockPosition")
                    .getVariable("pageBuilder")
View Full Code Here

                .getBody()
                .comment("super();")
                .pushThis()
                .invokeConstructor(Object.class);

        constructor.comment("this.lookupSource = lookupSource;")
                .append(context.getVariable("this").setField(lookupSourceField, context.getVariable("lookupSource")));

        constructor.comment("this.positionCount = page.getPositionCount();")
                .append(context.getVariable("this").setField(positionCountField, context.getVariable("page").invoke("getPositionCount", int.class)));
View Full Code Here

                .invokeConstructor(Object.class);

        constructor.comment("this.lookupSource = lookupSource;")
                .append(context.getVariable("this").setField(lookupSourceField, context.getVariable("lookupSource")));

        constructor.comment("this.positionCount = page.getPositionCount();")
                .append(context.getVariable("this").setField(positionCountField, context.getVariable("page").invoke("getPositionCount", int.class)));

        constructor.comment("Set block fields");
        for (int index = 0; index < blockFields.size(); index++) {
            constructor.append(context.getVariable("this").setField(
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.