Search in sources :

Example 1 with TestingTransactionManager

use of io.trino.transaction.TestingTransactionManager in project trino by trinodb.

the class TestExpressionInterpreter method planExpression.

// TODO replace that method with io.trino.sql.ExpressionTestUtils.planExpression
static Expression planExpression(@Language("SQL") String expression) {
    return TransactionBuilder.transaction(new TestingTransactionManager(), new AllowAllAccessControl()).singleStatement().execute(TEST_SESSION, transactionSession -> {
        Expression parsedExpression = SQL_PARSER.createExpression(expression, createParsingOptions(transactionSession));
        parsedExpression = rewriteIdentifiersToSymbolReferences(parsedExpression);
        parsedExpression = resolveFunctionCalls(PLANNER_CONTEXT, transactionSession, SYMBOL_TYPES, parsedExpression);
        parsedExpression = CanonicalizeExpressionRewriter.rewrite(parsedExpression, transactionSession, PLANNER_CONTEXT, createTestingTypeAnalyzer(PLANNER_CONTEXT), SYMBOL_TYPES);
        return parsedExpression;
    });
}
Also used : ExpressionFormatter.formatExpression(io.trino.sql.ExpressionFormatter.formatExpression) Expression(io.trino.sql.tree.Expression) AllowAllAccessControl(io.trino.security.AllowAllAccessControl) TestingTransactionManager(io.trino.transaction.TestingTransactionManager)

Aggregations

AllowAllAccessControl (io.trino.security.AllowAllAccessControl)1 ExpressionFormatter.formatExpression (io.trino.sql.ExpressionFormatter.formatExpression)1 Expression (io.trino.sql.tree.Expression)1 TestingTransactionManager (io.trino.transaction.TestingTransactionManager)1