Examples of LongLiteral


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

            Object optimizedExpression = expressionOptimizer(canonicalized, metadata, session, analyzer.getExpressionTypes()).optimize(NoOpSymbolResolver.INSTANCE);

            if (!(optimizedExpression instanceof Expression) && optimizedExpression instanceof Boolean) {
                // If the JoinOn clause evaluates to a boolean expression, simulate a cross join by adding the relevant redundant expression
                if (optimizedExpression.equals(Boolean.TRUE)) {
                    optimizedExpression = new ComparisonExpression(ComparisonExpression.Type.EQUAL, new LongLiteral("0"), new LongLiteral("0"));
                }
                else {
                    optimizedExpression = new ComparisonExpression(ComparisonExpression.Type.EQUAL, new LongLiteral("0"), new LongLiteral("1"));
                }
            }

            if (!(optimizedExpression instanceof Expression)) {
                throw new SemanticException(TYPE_MISMATCH, node, "Join clause must be a boolean expression");
View Full Code Here

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

        public PlanNode rewriteWindow(WindowNode node, WindowContext context, PlanRewriter<WindowContext> planRewriter)
        {
            if (context != null && canOptimizeWindowFunction(node, context)) {
                int limit = extractLimitOptional(node, context.getExpression()).get();
                if (node.getPartitionBy().isEmpty()) {
                    WindowContext windowContext = new WindowContext(Optional.of(node), new LongLiteral(String.valueOf(limit)));
                    PlanNode rewrittenSource = planRewriter.rewrite(node.getSource(), windowContext);
                    return new WindowNode(idAllocator.getNextId(),
                            rewrittenSource,
                            node.getPartitionBy(),
                            node.getOrderBy(),
View Full Code Here

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

                    // HACK! we don't support cross joins right now, so put in a simple fake join predicate instead if all of the join clauses got simplified out
                    // TODO: remove this code when cross join support is added
                    Iterable<Expression> simplifiedJoinConjuncts = transform(extractConjuncts(newJoinPredicate), simplifyExpressions());
                    simplifiedJoinConjuncts = filter(simplifiedJoinConjuncts, not(Predicates.<Expression>equalTo(BooleanLiteral.TRUE_LITERAL)));
                    if (Iterables.isEmpty(simplifiedJoinConjuncts)) {
                        simplifiedJoinConjuncts = ImmutableList.<Expression>of(new ComparisonExpression(ComparisonExpression.Type.EQUAL, new LongLiteral("0"), new LongLiteral("0")));
                    }

                    // Create new projections for the new join clauses
                    ImmutableList.Builder<JoinNode.EquiJoinClause> builder = ImmutableList.builder();
                    for (Expression conjunct : simplifiedJoinConjuncts) {
View Full Code Here

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

        if (object instanceof Expression) {
            return (Expression) object;
        }

        if (object instanceof Long) {
            return new LongLiteral(object.toString());
        }

        if (object instanceof Double) {
            Double value = (Double) object;
            if (value.isNaN()) {
View Full Code Here

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

        return new QualifiedNameReference(symbol.toQualifiedName());
    }

    private static Expression number(long number)
    {
        return new LongLiteral(String.valueOf(number));
    }
View Full Code Here

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

        return new QualifiedNameReference(new Symbol(symbol).toQualifiedName());
    }

    private static LongLiteral number(long number)
    {
        return new LongLiteral(String.valueOf(number));
    }
View Full Code Here

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

        return new QualifiedNameReference(symbol.toQualifiedName());
    }

    private static Expression number(long number)
    {
        return new LongLiteral(String.valueOf(number));
    }
View Full Code Here

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

        return new BetweenPredicate(reference(symbol), min, max);
    }

    private static LongLiteral longLiteral(long value)
    {
        return new LongLiteral(Long.toString(value));
    }
View Full Code Here

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

        return new BetweenPredicate(reference(symbol), min, max);
    }

    private static LongLiteral longLiteral(long value)
    {
        return new LongLiteral(Long.toString(value));
    }
View Full Code Here

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

                    // HACK! we don't support cross joins right now, so put in a simple fake join predicate instead if all of the join clauses got simplified out
                    // TODO: remove this code when cross join support is added
                    Iterable<Expression> simplifiedJoinConjuncts = transform(extractConjuncts(newJoinPredicate), simplifyExpressions());
                    simplifiedJoinConjuncts = filter(simplifiedJoinConjuncts, not(Predicates.<Expression>equalTo(BooleanLiteral.TRUE_LITERAL)));
                    if (Iterables.isEmpty(simplifiedJoinConjuncts)) {
                        simplifiedJoinConjuncts = ImmutableList.<Expression>of(new ComparisonExpression(ComparisonExpression.Type.EQUAL, new LongLiteral("0"), new LongLiteral("0")));
                    }

                    // Create new projections for the new join clauses
                    ImmutableList.Builder<JoinNode.EquiJoinClause> builder = ImmutableList.builder();
                    for (Expression conjunct : simplifiedJoinConjuncts) {
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.