Examples of ArithmeticExpression


Examples of com.facebook.presto.sql.tree.ArithmeticExpression

            if (right == null) {
                return null;
            }

            if (left instanceof Expression || right instanceof Expression) {
                return new ArithmeticExpression(node.getType(), toExpression(left), toExpression(right));
            }

            Number leftNumber = (Number) left;
            Number rightNumber = (Number) right;
            switch (node.getType()) {
View Full Code Here

Examples of com.facebook.presto.sql.tree.ArithmeticExpression

            if (right == null) {
                return null;
            }

            if (hasUnresolvedValue(left, right)) {
                return new ArithmeticExpression(node.getType(), toExpression(left, expressionTypes.get(node.getLeft())), toExpression(right, expressionTypes.get(node.getRight())));
            }

            return invokeOperator(OperatorType.valueOf(node.getType().name()), types(node.getLeft(), node.getRight()), ImmutableList.of(left, right));
        }
View Full Code Here

Examples of com.facebook.presto.sql.tree.ArithmeticExpression

            if (right == null) {
                return null;
            }

            if (hasUnresolvedValue(left, right)) {
                return new ArithmeticExpression(node.getType(), toExpression(left, expressionTypes.get(node.getLeft())), toExpression(right, expressionTypes.get(node.getRight())));
            }

            return invokeOperator(OperatorType.valueOf(node.getType().name()), types(node.getLeft(), node.getRight()), ImmutableList.of(left, right));
        }
View Full Code Here

Examples of com.facebook.presto.sql.tree.ArithmeticExpression

                    ImmutableMap.Builder<Symbol, Expression> projections = ImmutableMap.builder();
                    Expression sampleWeightExpr;
                    switch (node.getType()) {
                        case INNER:
                        case CROSS:
                            sampleWeightExpr = new ArithmeticExpression(ArithmeticExpression.Type.MULTIPLY, new QualifiedNameReference(leftSampleWeight.toQualifiedName()), new QualifiedNameReference(rightSampleWeight.toQualifiedName()));
                            break;
                        case LEFT:
                            sampleWeightExpr = new ArithmeticExpression(ArithmeticExpression.Type.MULTIPLY, new QualifiedNameReference(leftSampleWeight.toQualifiedName()), oneIfNull(rightSampleWeight));
                            break;
                        case RIGHT:
                            sampleWeightExpr = new ArithmeticExpression(ArithmeticExpression.Type.MULTIPLY, oneIfNull(leftSampleWeight), new QualifiedNameReference(rightSampleWeight.toQualifiedName()));
                            break;
                        default:
                            throw new AssertionError(String.format("Unknown join type: %s", node.getType()));
                    }
                    outputSampleWeight = symbolAllocator.newSymbol(sampleWeightExpr, BIGINT);
View Full Code Here

Examples of com.facebook.presto.sql.tree.ArithmeticExpression

            if (right == null) {
                return null;
            }

            if (hasUnresolvedValue(left, right)) {
                return new ArithmeticExpression(node.getType(), toExpression(left, expressionTypes.get(node.getLeft())), toExpression(right, expressionTypes.get(node.getRight())));
            }

            return invokeOperator(OperatorType.valueOf(node.getType().name()), types(node.getLeft(), node.getRight()), ImmutableList.of(left, right));
        }
View Full Code Here

Examples of com.facebook.presto.sql.tree.ArithmeticExpression

        return add(nameReference(symbol1), nameReference(symbol2));
    }

    private static Expression add(Expression expression1, Expression expression2)
    {
        return new ArithmeticExpression(ArithmeticExpression.Type.ADD, expression1, expression2);
    }
View Full Code Here

Examples of com.facebook.presto.sql.tree.ArithmeticExpression

        return multiply(nameReference(symbol1), nameReference(symbol2));
    }

    private static Expression multiply(Expression expression1, Expression expression2)
    {
        return new ArithmeticExpression(ArithmeticExpression.Type.MULTIPLY, expression1, expression2);
    }
View Full Code Here

Examples of com.facebook.presto.sql.tree.ArithmeticExpression

            if (right == null) {
                return null;
            }

            if (hasUnresolvedValue(left, right)) {
                return new ArithmeticExpression(node.getType(), toExpression(left, expressionTypes.get(node.getLeft())), toExpression(right, expressionTypes.get(node.getRight())));
            }

            return invokeOperator(OperatorType.valueOf(node.getType().name()), types(node.getLeft(), node.getRight()), ImmutableList.of(left, right));
        }
View Full Code Here

Examples of com.facebook.presto.sql.tree.ArithmeticExpression

                leftPlanBuilder.getRoot(),
                rightPlanBuilder.getRoot(),
                clauses.build());
        Optional<Symbol> sampleWeight = Optional.absent();
        if (leftPlanBuilder.getSampleWeight().isPresent() || rightPlanBuilder.getSampleWeight().isPresent()) {
            Expression expression = new ArithmeticExpression(ArithmeticExpression.Type.MULTIPLY, oneIfNull(leftPlanBuilder.getSampleWeight()), oneIfNull(rightPlanBuilder.getSampleWeight()));
            sampleWeight = Optional.of(symbolAllocator.newSymbol(expression, BIGINT));
            root = new ProjectNode(idAllocator.getNextId(), root, ImmutableMap.of(sampleWeight.get(), expression));
        }

        return new RelationPlan(root, outputDescriptor, outputSymbols, sampleWeight);
View Full Code Here

Examples of com.facebook.presto.sql.tree.ArithmeticExpression

            if (right == null) {
                return null;
            }

            if (left instanceof Expression || right instanceof Expression) {
                return new ArithmeticExpression(node.getType(), toExpression(left), toExpression(right));
            }

            Number leftNumber = (Number) left;
            Number rightNumber = (Number) right;
            switch (node.getType()) {
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.