PartitionUpdate.java 文件源码

java
阅读 16 收藏 0 点赞 0 评论 0

项目:presto 作者:
public static List<PartitionUpdate> mergePartitionUpdates(List<PartitionUpdate> unMergedUpdates)
{
    ImmutableList.Builder<PartitionUpdate> partitionUpdates = ImmutableList.builder();
    for (Collection<PartitionUpdate> partitionGroup : Multimaps.index(unMergedUpdates, PartitionUpdate::getName).asMap().values()) {
        PartitionUpdate firstPartition = partitionGroup.iterator().next();

        ImmutableList.Builder<String> allFileNames = ImmutableList.builder();
        for (PartitionUpdate partition : partitionGroup) {
            // verify partitions have the same new flag, write path and target path
            // this shouldn't happen but could if another user added a partition during the write
            if (partition.isNew() != firstPartition.isNew() ||
                    !partition.getWritePath().equals(firstPartition.getWritePath()) ||
                    !partition.getTargetPath().equals(firstPartition.getTargetPath())) {
                throw new PrestoException(HIVE_WRITER_ERROR, format("Partition %s was added or modified during INSERT", firstPartition.getName()));
            }
            allFileNames.addAll(partition.getFileNames());
        }

        partitionUpdates.add(new PartitionUpdate(firstPartition.getName(),
                firstPartition.isNew(),
                firstPartition.getWritePath(),
                firstPartition.getTargetPath(),
                allFileNames.build()));
    }
    return partitionUpdates.build();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号