Package com.facebook.presto.byteCode.control

Examples of com.facebook.presto.byteCode.control.IfStatement$IfStatementBuilder


                .pop()
                .pop();

        projectionMethod.getBody()
                .comment("if the result was null, appendNull; otherwise append the value")
                .append(new IfStatement(context, new Block(context).getVariable("wasNull"), nullBlock, notNullBlock))
                .ret();

        return projectionType.getJavaType();
    }
View Full Code Here


        classDefinition.declareMethod(context,
                a(PUBLIC),
                "getCurrentJoinPosition",
                type(long.class))
                .getBody()
                .append(new IfStatement(
                        context,
                        new Block(context).append(context.getVariable("this").invoke("currentRowContainsNull", boolean.class)),
                        new Block(context).push(-1L).retLong(),
                        null
                ))
View Full Code Here

            // for huge IN lists, use a Set
            Binding constant = generatorContext.getCallSiteBinder().bind(constantValues, Set.class);

            switchBlock = new Block(context)
                    .comment("inListSet.contains(<stackValue>)")
                    .append(new IfStatement(context,
                            new Block(context)
                                    .comment("value (+boxing if necessary)")
                                    .dup(javaType)
                                    .append(ByteCodeUtils.boxPrimitive(context, javaType))
                                    .comment("set")
View Full Code Here

        if (!stackArgsToPop.isEmpty()) {
            popComment = format("pop(%s)", Joiner.on(", ").join(stackArgsToPop));
        }

        String comment = format("if wasNull then %s", Joiner.on(", ").skipNulls().join(clearComment, popComment, loadDefaultComment, "goto " + label.getLabel()));
        return new IfStatement(context, comment, nullCheck, isNull, NOP);
    }
View Full Code Here

                .putVariable("wasNull", true)
                .pop(first.getType().getJavaType())
                .pushJavaDefault(first.getType().getJavaType());

        // else return first (which is still on the stack
        block.append(new IfStatement(context, conditionBlock, trueBlock, notMatch));

        return block;
    }
View Full Code Here

        Block block = new Block(context)
                .comment("IS DISTINCT FROM")
                .comment("left")
                .append(generatorContext.generate(left))
                .append(new IfStatement(context,
                        new Block(context).getVariable("wasNull"),
                        new Block(context)
                                .pop(leftType.getJavaType())
                                .putVariable("wasNull", false)
                                .comment("right is not null")
                                .append(generatorContext.generate(right))
                                .pop(rightType.getJavaType())
                                .getVariable("wasNull")
                                .invokeStatic(CompilerOperations.class, "not", boolean.class, boolean.class),
                        new Block(context)
                                .comment("right")
                                .append(generatorContext.generate(right))
                                .append(new IfStatement(context,
                                        new Block(context).getVariable("wasNull"),
                                        new Block(context)
                                                .pop(leftType.getJavaType())
                                                .pop(rightType.getJavaType())
                                                .push(true),
View Full Code Here

            Block nullBlock = new Block(context)
                    .pop(returnType.getJavaType())
                    .putVariable("wasNull", false)
                    .append(nullValue);

            nullValue = new IfStatement(context, condition, nullBlock, NOP);
        }

        return nullValue;
    }
View Full Code Here

        classDefinition.declareMethod(context,
                a(PUBLIC),
                "getCurrentJoinPosition",
                type(long.class))
                .getBody()
                .append(new IfStatement(
                        context,
                        new Block(context).append(context.getVariable("this").invoke("currentRowContainsNull", boolean.class)),
                        new Block(context).push(-1L).retLong(),
                        null
                ))
View Full Code Here

                .getVariable("wasNull")
                .invokeStatic(CompilerOperations.class, "not", boolean.class, boolean.class)
                .invokeStatic(CompilerOperations.class, "and", boolean.class, boolean.class, boolean.class)
                .putVariable("wasNull", false);

        return new IfStatement(context.getContext(),
                condition,
                context.generate(arguments.get(1)),
                context.generate(arguments.get(2)));
    }
View Full Code Here

            Block condition = new Block(context)
                    .append(equalsCall)
                    .putVariable("wasNull", false);

            elseValue = new IfStatement(context,
                    "when",
                    condition,
                    generatorContext.generate(result),
                    elseValue);
        }
View Full Code Here

TOP

Related Classes of com.facebook.presto.byteCode.control.IfStatement$IfStatementBuilder

Copyright © 2018 www.massapicom. 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.