public OutputBuffers withNoMoreBufferIds() { if (noMoreBufferIds) { return this; } return new OutputBuffers(type, version + 1, true, buffers); }
public static OutputBuffers createInitialEmptyOutputBuffers(BufferType type) { return new OutputBuffers(type, 0, false, ImmutableMap.of()); }
public OutputBuffers withBuffer(OutputBufferId bufferId, int partition) { requireNonNull(bufferId, "bufferId is null"); if (buffers.containsKey(bufferId)) { checkHasBuffer(bufferId, partition); return this; } // verify no new buffers is not set checkState(!noMoreBufferIds, "No more buffer ids already set"); return new OutputBuffers( type, version + 1, false, ImmutableMap.<OutputBufferId, Integer>builder() .putAll(buffers) .put(bufferId, partition) .build()); }
public OutputBuffers withBuffers(Map<OutputBufferId, Integer> buffers) { requireNonNull(buffers, "buffers is null"); Map<OutputBufferId, Integer> newBuffers = new HashMap<>(); for (Entry<OutputBufferId, Integer> entry : buffers.entrySet()) { OutputBufferId bufferId = entry.getKey(); int partition = entry.getValue(); // it is ok to have a duplicate buffer declaration but it must have the same page partition if (this.buffers.containsKey(bufferId)) { checkHasBuffer(bufferId, partition); continue; } newBuffers.put(bufferId, partition); } // if we don't have new buffers, don't update if (newBuffers.isEmpty()) { return this; } // verify no new buffers is not set checkState(!noMoreBufferIds, "No more buffer ids already set"); // add the existing buffers newBuffers.putAll(this.buffers); return new OutputBuffers(type, version + 1, false, newBuffers); }
public static OutputBuffers createInitialEmptyOutputBuffers(PartitioningHandle partitioningHandle) { BufferType type; if (partitioningHandle.equals(FIXED_BROADCAST_DISTRIBUTION)) { type = BROADCAST; } else if (partitioningHandle.equals(FIXED_ARBITRARY_DISTRIBUTION)) { type = ARBITRARY; } else { type = PARTITIONED; } return new OutputBuffers(type, 0, false, ImmutableMap.of()); }
public OutputBuffers withNoMoreBufferIds() { if (noMoreBufferIds) { return this; } return new OutputBuffers(version + 1, true, buffers); }
public OutputBuffers withBuffer(TaskId bufferId, int partition) { requireNonNull(bufferId, "bufferId is null"); if (buffers.containsKey(bufferId)) { checkHasBuffer(bufferId, partition); return this; } // verify no new buffers is not set checkState(!noMoreBufferIds, "No more buffer ids already set"); return new OutputBuffers( version + 1, false, ImmutableMap.<TaskId, Integer>builder() .putAll(buffers) .put(bufferId, partition) .build()); }
public OutputBuffers withBuffers(Map<TaskId, Integer> buffers) { requireNonNull(buffers, "buffers is null"); Map<TaskId, Integer> newBuffers = new HashMap<>(); for (Entry<TaskId, Integer> entry : buffers.entrySet()) { TaskId bufferId = entry.getKey(); int partition = entry.getValue(); // it is ok to have a duplicate buffer declaration but it must have the same page partition if (this.buffers.containsKey(bufferId)) { checkHasBuffer(bufferId, partition); continue; } newBuffers.put(bufferId, partition); } // if we don't have new buffers, don't update if (newBuffers.isEmpty()) { return this; } // verify no new buffers is not set checkState(!noMoreBufferIds, "No more buffer ids already set"); // add the existing buffers newBuffers.putAll(this.buffers); return new OutputBuffers(version + 1, false, newBuffers); }