Java 类com.facebook.presto.sql.tree.ResetSession 实例源码

项目:presto-query-formatter    文件:StatementFormatter.java   
@Override
public Void visitResetSession(ResetSession node, Integer context)
{
    builder.append("RESET SESSION ")
            .append(node.getName());

    return null;
}
项目:presto    文件:ResetSessionTask.java   
@Override
public CompletableFuture<?> execute(ResetSession statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine)
{
    if (statement.getName().getParts().size() > 2) {
        throw new SemanticException(INVALID_SESSION_PROPERTY, statement, "Invalid session property '%s'", statement.getName());
    }

    // validate the property name
    metadata.getSessionPropertyManager().getSessionPropertyMetadata(statement.getName().toString());

    stateMachine.addResetSessionProperties(statement.getName().toString());

    return completedFuture(null);
}
项目:presto    文件:TestResetSessionTask.java   
@Test
public void test()
        throws Exception
{
    Session session = TEST_SESSION.withSystemProperty("foo", "bar").withCatalogProperty("catalog", "baz", "blah");

    TransactionManager transactionManager = createTestTransactionManager();
    QueryStateMachine stateMachine = QueryStateMachine.begin(new QueryId("query"), "reset foo", session, URI.create("fake://uri"), false, transactionManager, executor);
    new ResetSessionTask().execute(new ResetSession(QualifiedName.of("catalog", "baz")), transactionManager, metadata, new AllowAllAccessControl(), stateMachine).join();

    Set<String> sessionProperties = stateMachine.getResetSessionProperties();
    assertEquals(sessionProperties, ImmutableSet.of("catalog.baz"));
}
项目:presto    文件:SqlFormatter.java   
@Override
public Void visitResetSession(ResetSession node, Integer context)
{
    builder.append("RESET SESSION ")
            .append(node.getName());

    return null;
}
项目:presto    文件:TestSqlParser.java   
@Test
public void testResetSession()
        throws Exception
{
    assertStatement("RESET SESSION foo.bar", new ResetSession(QualifiedName.of("foo", "bar")));
    assertStatement("RESET SESSION foo", new ResetSession(QualifiedName.of("foo")));
}
项目:EchoQuery    文件:SqlFormatter.java   
@Override
public Void visitResetSession(ResetSession node, Integer context)
{
    builder.append("RESET SESSION ")
            .append(node.getName());

    return null;
}
项目:presto    文件:AstBuilder.java   
@Override
public Node visitResetSession(SqlBaseParser.ResetSessionContext context)
{
    return new ResetSession(getLocation(context), getQualifiedName(context.qualifiedName()));
}