Package com.facebook.presto.sql.planner

Examples of com.facebook.presto.sql.planner.ExpressionInterpreter.optimize()


        private Expression simplifyExpression(Expression input)
        {
            IdentityHashMap<Expression, Type> expressionTypes = getExpressionTypes(session, metadata, types, input);
            ExpressionInterpreter interpreter = ExpressionInterpreter.expressionOptimizer(input, metadata, session, expressionTypes);
            return LiteralInterpreter.toExpression(interpreter.optimize(NoOpSymbolResolver.INSTANCE), expressionTypes.get(input));
        }
    }
}
View Full Code Here


                @Override
                public Expression apply(Expression expression)
                {
                    IdentityHashMap<Expression, Type> expressionTypes = getExpressionTypes(session, metadata, symbolAllocator.getTypes(), expression);
                    ExpressionInterpreter optimizer = ExpressionInterpreter.expressionOptimizer(expression, metadata, session, expressionTypes);
                    return LiteralInterpreter.toExpression(optimizer.optimize(NoOpSymbolResolver.INSTANCE), expressionTypes.get(expression));
                }
            };
        }

        /**
 
View Full Code Here

                    // If any conjuncts evaluate to FALSE or null, then the whole predicate will never be true and so the partition should be pruned
                    for (Expression expression : extractConjuncts(predicate)) {
                        IdentityHashMap<Expression, Type> expressionTypes = getExpressionTypes(session, metadata, symbolAllocator.getTypes(), expression);
                        ExpressionInterpreter optimizer = ExpressionInterpreter.expressionOptimizer(expression, metadata, session, expressionTypes);
                        Object optimized = optimizer.optimize(inputs);
                        if (Boolean.FALSE.equals(optimized) || optimized == null || optimized instanceof NullLiteral) {
                            return true;
                        }
                    }
                    return false;
View Full Code Here

        }

        IdentityHashMap<Expression, Type> expressionTypes = getExpressionTypes(session, metadata, sqlParser, ImmutableMap.<Symbol, Type>of(), relation.getSamplePercentage());
        ExpressionInterpreter samplePercentageEval = expressionOptimizer(relation.getSamplePercentage(), metadata, session, expressionTypes);

        Object samplePercentageObject = samplePercentageEval.optimize(new SymbolResolver()
        {
            @Override
            public Object getValue(Symbol symbol)
            {
                throw new SemanticException(NON_NUMERIC_SAMPLE_PERCENTAGE, relation.getSamplePercentage(), "Sample percentage cannot contain column references");
View Full Code Here

                @Override
                public Expression apply(Expression expression)
                {
                    IdentityHashMap<Expression, Type> expressionTypes = getExpressionTypes(session, metadata, sqlParser, symbolAllocator.getTypes(), expression);
                    ExpressionInterpreter optimizer = ExpressionInterpreter.expressionOptimizer(expression, metadata, session, expressionTypes);
                    return LiteralInterpreter.toExpression(optimizer.optimize(NoOpSymbolResolver.INSTANCE), expressionTypes.get(expression));
                }
            };
        }

        /**
 
View Full Code Here

                    // If any conjuncts evaluate to FALSE or null, then the whole predicate will never be true and so the partition should be pruned
                    for (Expression expression : extractConjuncts(predicate)) {
                        IdentityHashMap<Expression, Type> expressionTypes = getExpressionTypes(session, metadata, sqlParser, symbolAllocator.getTypes(), expression);
                        ExpressionInterpreter optimizer = ExpressionInterpreter.expressionOptimizer(expression, metadata, session, expressionTypes);
                        Object optimized = optimizer.optimize(inputs);
                        if (Boolean.FALSE.equals(optimized) || optimized == null || optimized instanceof NullLiteral) {
                            return true;
                        }
                    }
                    return false;
View Full Code Here

        }

        IdentityHashMap<Expression, Type> expressionTypes = getExpressionTypes(session, metadata, sqlParser, ImmutableMap.<Symbol, Type>of(), relation.getSamplePercentage());
        ExpressionInterpreter samplePercentageEval = expressionOptimizer(relation.getSamplePercentage(), metadata, session, expressionTypes);

        Object samplePercentageObject = samplePercentageEval.optimize(new SymbolResolver()
        {
            @Override
            public Object getValue(Symbol symbol)
            {
                throw new SemanticException(NON_NUMERIC_SAMPLE_PERCENTAGE, relation.getSamplePercentage(), "Sample percentage cannot contain column references");
View Full Code Here

            {
                @Override
                public Expression apply(Expression expression)
                {
                    ExpressionInterpreter optimizer = ExpressionInterpreter.expressionOptimizer(expression, metadata, session);
                    return ExpressionInterpreter.toExpression(optimizer.optimize(NoOpSymbolResolver.INSTANCE));
                }
            };
        }

        /**
 
View Full Code Here

        }

        private Expression simplifyExpression(Expression input)
        {
            ExpressionInterpreter interpreter = ExpressionInterpreter.expressionOptimizer(input, metadata, session);
            return ExpressionInterpreter.toExpression(interpreter.optimize(NoOpSymbolResolver.INSTANCE));
        }
    }
}
View Full Code Here

        LookupSymbolResolver inputs = new LookupSymbolResolver(assignments.build());

        // If any conjuncts evaluate to FALSE or null, then the whole predicate will never be true and so the partition should be pruned
        for (Expression expression : extractConjuncts(predicate)) {
            ExpressionInterpreter optimizer = ExpressionInterpreter.expressionOptimizer(expression, metadata, session);
            Object optimized = optimizer.optimize(inputs);
            if (Boolean.FALSE.equals(optimized) || optimized == null) {
                return true;
            }
        }
        return false;
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.