Search in sources :

Example 6 with ExpressionAnalyzer

use of com.facebook.presto.sql.analyzer.ExpressionAnalyzer in project presto by prestodb.

the class TestRowExpressionSerde method getExpressionTypes.

private Map<NodeRef<Expression>, Type> getExpressionTypes(Expression expression) {
    ExpressionAnalyzer expressionAnalyzer = ExpressionAnalyzer.createWithoutSubqueries(metadata.getFunctionAndTypeManager(), TEST_SESSION, TypeProvider.empty(), emptyList(), node -> new IllegalStateException("Unexpected node: %s" + node), WarningCollector.NOOP, false);
    expressionAnalyzer.analyze(expression, Scope.create());
    return expressionAnalyzer.getExpressionTypes();
}
Also used : ExpressionAnalyzer(com.facebook.presto.sql.analyzer.ExpressionAnalyzer)

Aggregations

ExpressionAnalyzer (com.facebook.presto.sql.analyzer.ExpressionAnalyzer)6 ArithmeticBinaryExpression (com.facebook.presto.sql.tree.ArithmeticBinaryExpression)3 ArithmeticUnaryExpression (com.facebook.presto.sql.tree.ArithmeticUnaryExpression)3 CoalesceExpression (com.facebook.presto.sql.tree.CoalesceExpression)3 ComparisonExpression (com.facebook.presto.sql.tree.ComparisonExpression)3 DereferenceExpression (com.facebook.presto.sql.tree.DereferenceExpression)3 Expression (com.facebook.presto.sql.tree.Expression)3 IfExpression (com.facebook.presto.sql.tree.IfExpression)3 InListExpression (com.facebook.presto.sql.tree.InListExpression)3 LambdaExpression (com.facebook.presto.sql.tree.LambdaExpression)3 LogicalBinaryExpression (com.facebook.presto.sql.tree.LogicalBinaryExpression)3 NotExpression (com.facebook.presto.sql.tree.NotExpression)3 NullIfExpression (com.facebook.presto.sql.tree.NullIfExpression)3 QuantifiedComparisonExpression (com.facebook.presto.sql.tree.QuantifiedComparisonExpression)3 SearchedCaseExpression (com.facebook.presto.sql.tree.SearchedCaseExpression)3 SimpleCaseExpression (com.facebook.presto.sql.tree.SimpleCaseExpression)3 SubqueryExpression (com.facebook.presto.sql.tree.SubqueryExpression)3 SubscriptExpression (com.facebook.presto.sql.tree.SubscriptExpression)3 CanonicalizeExpressionRewriter.canonicalizeExpression (com.facebook.presto.sql.planner.iterative.rule.CanonicalizeExpressionRewriter.canonicalizeExpression)2 SqlFunctionUtils.getSqlFunctionExpression (com.facebook.presto.sql.relational.SqlFunctionUtils.getSqlFunctionExpression)2