public FixedLifespanScheduler(BucketNodeMap bucketNodeMap, List<ConnectorPartitionHandle> partitionHandles, OptionalInt concurrentLifespansPerTask) { checkArgument(!partitionHandles.equals(ImmutableList.of(NOT_PARTITIONED))); checkArgument(partitionHandles.size() == bucketNodeMap.getBucketCount()); Map<Node, IntList> nodeToDriverGroupMap = new HashMap<>(); Int2ObjectMap<Node> driverGroupToNodeMap = new Int2ObjectOpenHashMap<>(); for (int bucket = 0; bucket < bucketNodeMap.getBucketCount(); bucket++) { Node node = bucketNodeMap.getAssignedNode(bucket).get(); nodeToDriverGroupMap.computeIfAbsent(node, key -> new IntArrayList()).add(bucket); driverGroupToNodeMap.put(bucket, node); } this.driverGroupToNodeMap = driverGroupToNodeMap; this.nodeToDriverGroupsMap = nodeToDriverGroupMap.entrySet().stream() .collect(toImmutableMap(Map.Entry::getKey, entry -> entry.getValue().iterator())); this.partitionHandles = requireNonNull(partitionHandles, "partitionHandles is null"); if (concurrentLifespansPerTask.isPresent()) { checkArgument(concurrentLifespansPerTask.getAsInt() >= 1, "concurrentLifespansPerTask must be great or equal to 1 if present"); } this.concurrentLifespansPerTask = requireNonNull(concurrentLifespansPerTask, "concurrentLifespansPerTask is null"); }
boolean required = field.isRequired(); int offset = 0; offsets.add(offset); for (int i = 0; i < definitionLevels.length; i = getNextCollectionStartIndex(repetitionLevels, maxElementRepetitionLevel, i)) { if (ParquetTypeUtils.isValueNull(required, definitionLevels[i], maxDefinitionLevel)) { offsets.add(offset); offsets.add(offset); offsets.add(offset);
public static IntList toIntList(IntIterator iterator) { final IntList integers = new IntArrayList(); while (iterator.hasNext()) { integers.add(iterator.nextInt()); } return IntLists.unmodifiable(integers); }
@Override public int put(int value) { int id = _valueToIdMap.get(value); if (id == INVALID_KEY) { id = _idToValueMap.size(); _valueToIdMap.put(value, id); _idToValueMap.add(value); } return id; }
while (objects.hasNext()) { IndexedInts next = objects.next(); offsetList.add(offset); for (int i = 0, size = next.size(); i < size; i++) { values.add(next.get(i)); offsetList.add(offset); int offsetMax = offset; CompressedVSizeColumnarIntsSupplier headerSupplier = CompressedVSizeColumnarIntsSupplier.fromList(
private static int[] filterInts(IntSet intSet, int[] source) { IntList intList = new IntArrayList(); for (int value : source) { if (intSet.contains(value)) { intList.add(value); } } if (intList.size() == source.length) { return source; } else { return intList.toIntArray(); } }
@Override public int[] getMatchingDictIds() { if (_matchingDictIds == null) { IntList matchingDictIds = new IntArrayList(); int dictionarySize = _dictionary.length(); for (int dictId = 0; dictId < dictionarySize; dictId++) { if (applySV(dictId)) { matchingDictIds.add(dictId); } } _matchingDictIds = matchingDictIds.toIntArray(); } return _matchingDictIds; } }
@Test public void smokeTest() { ThreadLocalRandom r = ThreadLocalRandom.current(); for (int i = 0; i < 1000; i++) { int numIterators = r.nextInt(1, 11); List<IntList> lists = new ArrayList<>(numIterators); for (int j = 0; j < numIterators; j++) { lists.add(new IntArrayList()); } for (int j = 0; j < 50; j++) { lists.get(r.nextInt(numIterators)).add(j); } for (int j = 0; j < lists.size() + 1; j++) { assertAscending(mergeAscending(iteratorsFromLists(lists))); Collections.rotate(lists, 1); } for (int j = 0; j < 10; j++) { Collections.shuffle(lists); assertAscending(mergeAscending(iteratorsFromLists(lists))); } } }
eventsPerThread.get(ThreadLocalRandom.current().nextInt(nThreads)).add(i);
palette.add(type);
for (int value : _intMVValues[i]) { if (value == 1 || value == 2 || value == 9 || value == 5) { expectedList.add(value);
if (encoded == -1) { encoded = palette.size(); palette.add(value); if (encoded > data.getLargestPossibleValue()) {
@Override public boolean add(int key) { return list.add(key); } @Override
@Override public void add(final int i, final int k) { synchronized (sync) { list.add(i, k); } } @Override
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default void add(int index, Integer key) { add(index, (key).intValue()); } /**
@Override public boolean add(final int k) { l.add(to, k); to++; assert assertRange(); return true; } @Override
@Override public Iterable<Integer> getPartitionIds() { if (partitionIds == null) { partitionIds = new IntArrayList(partitions.size()); for (int i = 0; i < partitions.size(); i++) { partitionIds.add(i); } } Preconditions.checkState(partitionIds.size() == partitions.size()); return partitionIds; }
@Override public void add(final int index, final int k) { ensureIndex(index); l.add(from + index, k); to++; assert assertRange(); } @Override