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

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

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

Metadata.finishInsert介绍

[英]Finish insert query
[中]完成插入查询

代码示例

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

private static TableFinisher createTableFinisher(Session session, TableFinishNode node, Metadata metadata)
{
  WriterTarget target = node.getTarget();
  return (fragments, statistics) -> {
    if (target instanceof CreateHandle) {
      return metadata.finishCreateTable(session, ((CreateHandle) target).getHandle(), fragments, statistics);
    }
    else if (target instanceof InsertHandle) {
      return metadata.finishInsert(session, ((InsertHandle) target).getHandle(), fragments, statistics);
    }
    else if (target instanceof DeleteHandle) {
      metadata.finishDelete(session, ((DeleteHandle) target).getHandle(), fragments);
      return Optional.empty();
    }
    else {
      throw new AssertionError("Unhandled target type: " + target.getClass().getName());
    }
  };
}

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

private HiveInsertTableHandle getHiveInsertTableHandle(Session session, String tableName)
{
  Metadata metadata = ((DistributedQueryRunner) getQueryRunner()).getCoordinator().getMetadata();
  return transaction(getQueryRunner().getTransactionManager(), getQueryRunner().getAccessControl())
      .execute(session, transactionSession -> {
        QualifiedObjectName objectName = new QualifiedObjectName(catalog, TPCH_SCHEMA, tableName);
        Optional<TableHandle> handle = metadata.getTableHandle(transactionSession, objectName);
        InsertTableHandle insertTableHandle = metadata.beginInsert(transactionSession, handle.get());
        HiveInsertTableHandle hiveInsertTableHandle = (HiveInsertTableHandle) insertTableHandle.getConnectorHandle();
        metadata.finishInsert(transactionSession, insertTableHandle, ImmutableList.of(), ImmutableList.of());
        return hiveInsertTableHandle;
      });
}

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

@Override
  public void finishTable(Collection<Slice> fragments)
  {
    if (target instanceof CreateHandle) {
      metadata.finishCreateTable(session, ((CreateHandle) target).getHandle(), fragments);
    }
    else if (target instanceof InsertHandle) {
      metadata.finishInsert(session, ((InsertHandle) target).getHandle(), fragments);
    }
    else if (target instanceof DeleteHandle) {
      metadata.finishDelete(session, ((DeleteHandle) target).getHandle(), fragments);
    }
    else {
      throw new AssertionError("Unhandled target type: " + target.getClass().getName());
    }
  }
};

相关文章