public IntColumn set(int i, int val) { data.set(i, val); return this; }
public DateColumn set(int index, int value) { data.set(index, value); return this; }
public TimeColumn set(int index, int value) { data.set(index, value); return this; }
@Override public DateColumn set(int index, LocalDate value) { data.set(index, PackedLocalDate.pack(value)); return this; }
@Override public TimeColumn setMissing(int i) { data.set(i, TimeColumnType.missingValueIndicator()); return this; }
private void rehash() { long newCapacityLong = hashCapacity * 2L; if (newCapacityLong > Integer.MAX_VALUE) { throw new PrestoException(GENERIC_INSUFFICIENT_RESOURCES, "Size of hash table cannot exceed 1 billion entries"); } int newCapacity = (int) newCapacityLong; hashCapacity = newCapacity; hashMask = newCapacity - 1; maxFill = calculateMaxFill(newCapacity); blockPositionByHash.size(newCapacity); for (int i = 0; i < newCapacity; i++) { blockPositionByHash.set(i, EMPTY_SLOT); } for (int blockPosition = initialElementBlockOffset; blockPosition < elementBlock.getPositionCount(); blockPosition++) { blockPositionByHash.set(getHashPositionOfElement(elementBlock, blockPosition), blockPosition); } }
public TypedSet(Type elementType, BlockBuilder blockBuilder, int expectedSize, String functionName) { checkArgument(expectedSize >= 0, "expectedSize must not be negative"); this.elementType = requireNonNull(elementType, "elementType must not be null"); this.elementBlock = requireNonNull(blockBuilder, "blockBuilder must not be null"); this.functionName = functionName; initialElementBlockOffset = elementBlock.getPositionCount(); initialElementBlockSizeInBytes = elementBlock.getSizeInBytes(); this.size = 0; this.hashCapacity = arraySize(expectedSize, FILL_RATIO); this.maxFill = calculateMaxFill(hashCapacity); this.hashMask = hashCapacity - 1; blockPositionByHash = new IntArrayList(hashCapacity); blockPositionByHash.size(hashCapacity); for (int i = 0; i < hashCapacity; i++) { blockPositionByHash.set(i, EMPTY_SLOT); } this.containsNullElement = false; }
private void addNewElement(int hashPosition, Block block, int position) { elementType.appendTo(block, position, elementBlock); if (elementBlock.getSizeInBytes() - initialElementBlockSizeInBytes > FOUR_MEGABYTES) { throw new PrestoException( EXCEEDED_FUNCTION_MEMORY_LIMIT, format("The input to %s is too large. More than %s of memory is needed to hold the intermediate hash set.\n", functionName, MAX_FUNCTION_MEMORY)); } blockPositionByHash.set(hashPosition, elementBlock.getPositionCount() - 1); // increase capacity, if necessary size++; if (size >= maxFill) { rehash(); } }
@Override public void set(int rowIndex, String stringValue) throws NoKeysAvailableException { String str = StringColumnType.missingValueIndicator(); if (stringValue != null) { str = stringValue; } int valueId = getKeyForValue(str); if (valueId == DEFAULT_RETURN_VALUE) { valueId = getValueId(); put(valueId, str); } values.set(rowIndex, valueId); }
@Override public long set(int index, long k) { ensureCanInsert(k); if (fullImpl != null) { return fullImpl.set(index, k); } else { assert compactImpl != null; return compactImpl.set(index, (int) k); } }
public TimeColumn set(int index, int value) { data.set(index, value); return this; }
/** * Set the given value to the entry with the index specified. * * @param i the entry * @param value the value to set to the entry */ public void set(int i, int value) { entries.set(i, value); }
public void set(int index, int value) { data.set(index, value); }
@Override public void set(int k) { if (last == -1) throw new IllegalStateException(); IntArrayList.this.set(last, k); } @Override
@Override public TimeColumn setMissing(int i) { data.set(i, TimeColumnType.missingValueIndicator()); return this; }
@Override public DateColumn set(int index, LocalDate value) { data.set(index, PackedLocalDate.pack(value)); return this; }
@Override public long set(int index, long k) { ensureCanInsert(k); if (fullImpl != null) { return fullImpl.set(index, k); } else { assert compactImpl != null; return compactImpl.set(index, (int) k); } }
} else { sums.set(idx, sums.getDouble(idx) + r.getValue()); counts.set(idx, counts.getInt(idx) + 1);
@Override public long set(int index, long k) { ensureCanInsert(k); if (fullImpl != null) { return fullImpl.set(index, k); } else { assert compactImpl != null; return compactImpl.set(index, (int) k); } }
private static void remove(final IntArrayList queue, final int v, final int[] posInQueue) { final int position = posInQueue[v]; assert position < queue.size(); final int last = queue.popInt(); if (position == queue.size()) return; queue.set(posInQueue[last] = position, last); }