Search in sources :

Example 26 with AllowAllAccessControl

use of io.trino.security.AllowAllAccessControl in project trino by trinodb.

the class TestCreateViewTask method executeCreateView.

private ListenableFuture<Void> executeCreateView(QualifiedName viewName, boolean replace) {
    Query query = simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("mock_table")));
    CreateView statement = new CreateView(viewName, query, replace, Optional.empty(), Optional.empty());
    return new CreateViewTask(metadata, new AllowAllAccessControl(), parser, analyzerFactory).execute(statement, queryStateMachine, ImmutableList.of(), WarningCollector.NOOP);
}
Also used : Query(io.trino.sql.tree.Query) QueryUtil.simpleQuery(io.trino.sql.QueryUtil.simpleQuery) AllowAllAccessControl(io.trino.security.AllowAllAccessControl) AllColumns(io.trino.sql.tree.AllColumns) CreateView(io.trino.sql.tree.CreateView)

Example 27 with AllowAllAccessControl

use of io.trino.security.AllowAllAccessControl 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)

Example 28 with AllowAllAccessControl

use of io.trino.security.AllowAllAccessControl in project trino by trinodb.

the class TestMinimalFunctionality method testTableExists.

@Test
public void testTableExists() {
    QualifiedObjectName name = new QualifiedObjectName("redis", "default", tableName);
    transaction(queryRunner.getTransactionManager(), new AllowAllAccessControl()).singleStatement().execute(SESSION, session -> {
        Optional<TableHandle> handle = queryRunner.getServer().getMetadata().getTableHandle(session, name);
        assertTrue(handle.isPresent());
    });
}
Also used : AllowAllAccessControl(io.trino.security.AllowAllAccessControl) TableHandle(io.trino.metadata.TableHandle) QualifiedObjectName(io.trino.metadata.QualifiedObjectName) Test(org.testng.annotations.Test)

Aggregations

AllowAllAccessControl (io.trino.security.AllowAllAccessControl)28 Test (org.testng.annotations.Test)16 QualifiedObjectName (io.trino.metadata.QualifiedObjectName)9 TableHandle (io.trino.metadata.TableHandle)8 CatalogName (io.trino.connector.CatalogName)7 PropertyMetadata.stringProperty (io.trino.spi.session.PropertyMetadata.stringProperty)7 BeforeMethod (org.testng.annotations.BeforeMethod)7 Session (io.trino.Session)6 AbstractMockMetadata (io.trino.metadata.AbstractMockMetadata)6 TablePropertyManager (io.trino.metadata.TablePropertyManager)6 TransactionManager (io.trino.transaction.TransactionManager)6 ImmutableMap (com.google.common.collect.ImmutableMap)5 PlannerContext (io.trino.sql.PlannerContext)5 ColumnDefinition (io.trino.sql.tree.ColumnDefinition)5 CreateTable (io.trino.sql.tree.CreateTable)5 Identifier (io.trino.sql.tree.Identifier)5 Property (io.trino.sql.tree.Property)5 ImmutableList (com.google.common.collect.ImmutableList)4 Sets.immutableEnumSet (com.google.common.collect.Sets.immutableEnumSet)4 MoreFutures.getFutureValue (io.airlift.concurrent.MoreFutures.getFutureValue)4