Package com.facebook.presto.sql.tree

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


    public void testFilter()
            throws Exception
    {
        PlanNode node = filter(baseTableScan,
                and(
                        greaterThan(AE, new FunctionCall(QualifiedName.of("rand"), ImmutableList.<Expression>of())),
                        lessThan(BE, number(10))));

        Expression effectivePredicate = EffectivePredicateExtractor.extract(node, TYPES);

        // Non-deterministic functions should be purged
View Full Code Here


        return new IsNullPredicate(expression);
    }

    private static FunctionCall fakeFunction(String name)
    {
        return new FunctionCall(QualifiedName.of("test"), ImmutableList.<Expression>of());
    }
View Full Code Here

    public void testFilter()
            throws Exception
    {
        PlanNode node = filter(baseTableScan,
                and(
                        greaterThan(AE, new FunctionCall(QualifiedName.of("rand"), ImmutableList.<Expression>of())),
                        lessThan(BE, number(10))));

        Expression effectivePredicate = EffectivePredicateExtractor.extract(node);

        // Non-deterministic functions should be purged
View Full Code Here

        return new IsNullPredicate(expression);
    }

    private static FunctionCall fakeFunction(String name)
    {
        return new FunctionCall(QualifiedName.of("test"), ImmutableList.<Expression>of());
    }
View Full Code Here

        return new SearchedCaseExpression(ImmutableList.of(new WhenClause(operand, result)), null);
    }

    public static Expression functionCall(String name, Expression... arguments)
    {
        return new FunctionCall(new QualifiedName(name), ImmutableList.copyOf(arguments));
    }
View Full Code Here

                throw new UnsupportedOperationException("not yet implemented: non-default precision");
            }

            switch (node.getType()) {
                case DATE:
                    return new FunctionCall(new QualifiedName("current_date"), ImmutableList.<Expression>of());
                case TIME:
                    return new FunctionCall(new QualifiedName("current_time"), ImmutableList.<Expression>of());
                case LOCALTIME:
                    return new FunctionCall(new QualifiedName("localtime"), ImmutableList.<Expression>of());
                case TIMESTAMP:
                    return new FunctionCall(new QualifiedName("current_timestamp"), ImmutableList.<Expression>of());
                case LOCALTIMESTAMP:
                    return new FunctionCall(new QualifiedName("localtimestamp"), ImmutableList.<Expression>of());
                default:
                    throw new UnsupportedOperationException("not yet implemented: " + node.getType());
            }
        }
View Full Code Here

        {
            Expression value = treeRewriter.rewrite(node.getExpression(), context);

            switch (node.getField()) {
                case YEAR:
                    return new FunctionCall(new QualifiedName("year"), ImmutableList.of(value));
                case QUARTER:
                    return new FunctionCall(new QualifiedName("quarter"), ImmutableList.of(value));
                case MONTH:
                    return new FunctionCall(new QualifiedName("month"), ImmutableList.of(value));
                case WEEK:
                    return new FunctionCall(new QualifiedName("week"), ImmutableList.of(value));
                case DAY:
                case DAY_OF_MONTH:
                    return new FunctionCall(new QualifiedName("day"), ImmutableList.of(value));
                case DAY_OF_WEEK:
                case DOW:
                    return new FunctionCall(new QualifiedName("day_of_week"), ImmutableList.of(value));
                case DAY_OF_YEAR:
                case DOY:
                    return new FunctionCall(new QualifiedName("day_of_year"), ImmutableList.of(value));
                case HOUR:
                    return new FunctionCall(new QualifiedName("hour"), ImmutableList.of(value));
                case MINUTE:
                    return new FunctionCall(new QualifiedName("minute"), ImmutableList.of(value));
                case SECOND:
                    return new FunctionCall(new QualifiedName("second"), ImmutableList.of(value));
                case TIMEZONE_MINUTE:
                    return new FunctionCall(new QualifiedName("timezone_minute"), ImmutableList.of(value));
                case TIMEZONE_HOUR:
                    return new FunctionCall(new QualifiedName("timezone_hour"), ImmutableList.of(value));
            }

            throw new UnsupportedOperationException("not yet implemented: " + node.getField());
        }
View Full Code Here

            ImmutableMap.Builder<Symbol, Symbol> masks = ImmutableMap.builder();
            for (Map.Entry<Symbol, FunctionCall> entry : node.getAggregations().entrySet()) {
                Symbol symbol = entry.getKey();

                if (expectedOutputs.contains(symbol)) {
                    FunctionCall call = entry.getValue();
                    expectedInputs.addAll(DependencyExtractor.extractUnique(call));
                    if (node.getMasks().containsKey(symbol)) {
                        expectedInputs.add(node.getMasks().get(symbol));
                        masks.put(symbol, node.getMasks().get(symbol));
                    }
View Full Code Here

            ImmutableMap.Builder<Symbol, FunctionCall> functionCalls = ImmutableMap.builder();
            for (Map.Entry<Symbol, FunctionCall> entry : node.getWindowFunctions().entrySet()) {
                Symbol symbol = entry.getKey();

                if (expectedOutputs.contains(symbol)) {
                    FunctionCall call = entry.getValue();
                    expectedInputs.addAll(DependencyExtractor.extractUnique(call));

                    functionCalls.put(symbol, call);
                    functions.put(symbol, node.getSignatures().get(symbol));
                }
View Full Code Here

            PlanNode source = planRewriter.rewrite(node.getSource(), context);
            if (source instanceof ProjectNode) {
                ProjectNode projectNode = (ProjectNode) source;
                for (Entry<Symbol, FunctionCall> entry : node.getAggregations().entrySet()) {
                    Symbol symbol = entry.getKey();
                    FunctionCall functionCall = entry.getValue();
                    Signature signature = node.getFunctions().get(symbol);
                    if (isCountConstant(projectNode, functionCall, signature)) {
                        aggregations.put(symbol, new FunctionCall(functionCall.getName(), null, functionCall.isDistinct(), ImmutableList.<Expression>of()));
                        functions.put(symbol, new Signature("count", StandardTypes.BIGINT));
                    }
                }
            }
View Full Code Here

TOP

Related Classes of com.facebook.presto.sql.tree.FunctionCall

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.