com.facebook.presto.metadata.Metadata.dropTable()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中com.facebook.presto.metadata.Metadata.dropTable()方法的一些代码示例,展示了Metadata.dropTable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metadata.dropTable()方法的具体详情如下:
包路径:com.facebook.presto.metadata.Metadata
类名称:Metadata
方法名:dropTable

Metadata.dropTable介绍

[英]Drops the specified table
[中]删除指定的表

代码示例

代码示例来源:origin: prestodb/presto

@Override
  public ListenableFuture<?> execute(DropTable statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters)
  {
    Session session = stateMachine.getSession();
    QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getTableName());

    Optional<TableHandle> tableHandle = metadata.getTableHandle(session, tableName);
    if (!tableHandle.isPresent()) {
      if (!statement.isExists()) {
        throw new SemanticException(MISSING_TABLE, statement, "Table '%s' does not exist", tableName);
      }
      return immediateFuture(null);
    }

    accessControl.checkCanDropTable(session.getRequiredTransactionId(), session.getIdentity(), tableName);

    metadata.dropTable(session, tableHandle.get());

    return immediateFuture(null);
  }
}

代码示例来源:origin: prestodb/presto

public void dropTable(String tableName)
{
  Session session = localQueryRunner.getDefaultSession();
  Metadata metadata = localQueryRunner.getMetadata();
  Optional<TableHandle> tableHandle = metadata.getTableHandle(session, QualifiedObjectName.valueOf(tableName));
  assertTrue(tableHandle.isPresent(), "Table " + tableName + " does not exist");
  metadata.dropTable(session, tableHandle.get());
}

代码示例来源:origin: prestodb/presto

@TearDown(Level.Invocation)
public void dropPointsTable()
{
  queryRunner.inTransaction(queryRunner.getDefaultSession(), transactionSession -> {
    Metadata metadata = queryRunner.getMetadata();
    Optional<TableHandle> tableHandle = metadata.getTableHandle(transactionSession, QualifiedObjectName.valueOf("memory.default.points"));
    assertTrue(tableHandle.isPresent(), "Table memory.default.points does not exist");
    metadata.dropTable(transactionSession, tableHandle.get());
    return null;
  });
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

@Override
  public CompletableFuture<?> execute(DropTable statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine)
  {
    Session session = stateMachine.getSession();
    QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getTableName());

    Optional<TableHandle> tableHandle = metadata.getTableHandle(session, tableName);
    if (!tableHandle.isPresent()) {
      if (!statement.isExists()) {
        throw new SemanticException(MISSING_TABLE, statement, "Table '%s' does not exist", tableName);
      }
      return completedFuture(null);
    }

    accessControl.checkCanDropTable(session.getRequiredTransactionId(), session.getIdentity(), tableName);

    metadata.dropTable(session, tableHandle.get());

    return completedFuture(null);
  }
}

代码示例来源:origin: com.facebook.presto/presto-benchmark

public void dropTable(String tableName)
{
  Session session = localQueryRunner.getDefaultSession();
  Metadata metadata = localQueryRunner.getMetadata();
  Optional<TableHandle> tableHandle = metadata.getTableHandle(session, QualifiedObjectName.valueOf(tableName));
  assertTrue(tableHandle.isPresent(), "Table " + tableName + " does not exist");
  metadata.dropTable(session, tableHandle.get());
}

代码示例来源:origin: com.facebook.presto/presto-geospatial

@TearDown(Level.Invocation)
public void dropPointsTable()
{
  queryRunner.inTransaction(queryRunner.getDefaultSession(), transactionSession -> {
    Metadata metadata = queryRunner.getMetadata();
    Optional<TableHandle> tableHandle = metadata.getTableHandle(transactionSession, QualifiedObjectName.valueOf("memory.default.points"));
    assertTrue(tableHandle.isPresent(), "Table memory.default.points does not exist");
    metadata.dropTable(transactionSession, tableHandle.get());
    return null;
  });
}

相关文章