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

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

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

Metadata.beginInsert介绍

[英]Begin insert query
[中]开始插入查询

代码示例

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

private TableWriterNode.WriterTarget createWriterTarget(TableWriterNode.WriterTarget target)
{
  // TODO: begin these operations in pre-execution step, not here
  // TODO: we shouldn't need to store the schemaTableName in the handles, but there isn't a good way to pass this around with the current architecture
  if (target instanceof TableWriterNode.CreateName) {
    TableWriterNode.CreateName create = (TableWriterNode.CreateName) target;
    return new TableWriterNode.CreateHandle(metadata.beginCreateTable(session, create.getCatalog(), create.getTableMetadata(), create.getLayout()), create.getTableMetadata().getTable());
  }
  if (target instanceof TableWriterNode.InsertReference) {
    TableWriterNode.InsertReference insert = (TableWriterNode.InsertReference) target;
    return new TableWriterNode.InsertHandle(metadata.beginInsert(session, insert.getHandle()), metadata.getTableMetadata(session, insert.getHandle()).getTable());
  }
  if (target instanceof TableWriterNode.DeleteHandle) {
    TableWriterNode.DeleteHandle delete = (TableWriterNode.DeleteHandle) target;
    return new TableWriterNode.DeleteHandle(metadata.beginDelete(session, delete.getHandle()), delete.getSchemaTableName());
  }
  throw new IllegalArgumentException("Unhandled target type: " + target.getClass().getSimpleName());
}

代码示例来源: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

private TableWriterNode.WriterTarget createWriterTarget(TableWriterNode.WriterTarget target)
{
  // TODO: begin these operations in pre-execution step, not here
  if (target instanceof TableWriterNode.CreateName) {
    TableWriterNode.CreateName create = (TableWriterNode.CreateName) target;
    return new TableWriterNode.CreateHandle(metadata.beginCreateTable(session, create.getCatalog(), create.getTableMetadata(), create.getLayout()));
  }
  if (target instanceof TableWriterNode.InsertReference) {
    TableWriterNode.InsertReference insert = (TableWriterNode.InsertReference) target;
    return new TableWriterNode.InsertHandle(metadata.beginInsert(session, insert.getHandle()));
  }
  if (target instanceof TableWriterNode.DeleteHandle) {
    TableWriterNode.DeleteHandle delete = (TableWriterNode.DeleteHandle) target;
    return new TableWriterNode.DeleteHandle(metadata.beginDelete(session, delete.getHandle()));
  }
  throw new IllegalArgumentException("Unhandled target type: " + target.getClass().getSimpleName());
}

相关文章