@Override public void open() { tempOut = new LongArrayList(); }
public static LongColumn create(final String name, final long[] arr) { return new LongColumn(name, new LongArrayList(arr)); }
private void initializeHeaderOutLong() throws IOException { headerOutLong = new LongArrayList(); DataInput headerOutAsIntInput = new DataInputStream(headerOut.asInputStream()); for (int i = 0; i < numWritten; i++) { int count = headerOutAsIntInput.readInt(); headerOutLong.add(count); } }
public static DateTimeColumn create(String name, LocalDateTime[] data) { DateTimeColumn column = new DateTimeColumn(name, new LongArrayList(data.length)); for (LocalDateTime date : data) { column.append(date); } return column; }
public static DateTimeColumn create(String name, int initialSize) { DateTimeColumn column = new DateTimeColumn(name, new LongArrayList(initialSize)); for (int i = 0; i < initialSize; i++) { column.appendMissing(); } return column; }
public static LongColumn create(final String name, final int initialSize) { LongColumn column = new LongColumn(name, new LongArrayList(initialSize)); for (int i = 0; i < initialSize; i++) { column.appendMissing(); } return column; }
public static DateTimeColumn create(String name, List<LocalDateTime> data) { DateTimeColumn column = new DateTimeColumn(name, new LongArrayList(data.size())); for (LocalDateTime date : data) { column.append(date); } return column; }
private PagesIndex( OrderingCompiler orderingCompiler, JoinCompiler joinCompiler, FunctionRegistry functionRegistry, boolean groupByUsesEqualTo, List<Type> types, int expectedPositions, boolean eagerCompact) { this.orderingCompiler = requireNonNull(orderingCompiler, "orderingCompiler is null"); this.joinCompiler = requireNonNull(joinCompiler, "joinCompiler is null"); this.functionRegistry = requireNonNull(functionRegistry, "functionRegistry is null"); this.groupByUsesEqualTo = groupByUsesEqualTo; this.types = ImmutableList.copyOf(requireNonNull(types, "types is null")); this.valueAddresses = new LongArrayList(expectedPositions); this.eagerCompact = eagerCompact; //noinspection rawtypes channels = (ObjectArrayList<Block>[]) new ObjectArrayList[types.size()]; for (int i = 0; i < channels.length; i++) { channels[i] = ObjectArrayList.wrap(new Block[1024], 0); } estimatedSize = calculateEstimatedSize(); }
public LongToIdMap() { _valueToIdMap = new Long2IntOpenHashMap(); _valueToIdMap.defaultReturnValue(INVALID_KEY); _idToValueMap = new LongArrayList(); }
private void initDoubleValues() { if (predicate != null) { return; } synchronized (initLock) { if (predicate != null) { return; } LongArrayList doubleBits = new LongArrayList(values.size()); for (String value : values) { Double doubleValue = Doubles.tryParse(value); if (doubleValue != null) { doubleBits.add(Double.doubleToLongBits((doubleValue))); } } if (doubleBits.size() > NUMERIC_HASHING_THRESHOLD) { final LongOpenHashSet doubleBitsHashSet = new LongOpenHashSet(doubleBits); predicate = input -> doubleBitsHashSet.contains(Double.doubleToLongBits(input)); } else { final long[] doubleBitsArray = doubleBits.toLongArray(); Arrays.sort(doubleBitsArray); predicate = input -> Arrays.binarySearch(doubleBitsArray, Double.doubleToLongBits(input)) >= 0; } } } @Override
protected LongIterator beginFpMerge() { newFps = new LongArrayList((int) (allFps.size()+(pending()/2))); return allFps.iterator(); }
private void initLongValues() { if (predicate != null) { return; } synchronized (initLock) { if (predicate != null) { return; } LongArrayList longs = new LongArrayList(values.size()); for (String value : values) { final Long longValue = DimensionHandlerUtils.getExactLongFromDecimalString(value); if (longValue != null) { longs.add(longValue); } } if (longs.size() > NUMERIC_HASHING_THRESHOLD) { final LongOpenHashSet longHashSet = new LongOpenHashSet(longs); predicate = input -> longHashSet.contains(input); } else { final long[] longArray = longs.toLongArray(); Arrays.sort(longArray); predicate = input -> Arrays.binarySearch(longArray, input) >= 0; } } }
@Override public LongColumn lag(int n) { final int srcPos = n >= 0 ? 0 : 0 - n; final long[] dest = new long[size()]; final int destPos = n <= 0 ? 0 : n; final int length = n >= 0 ? size() - n : size() + n; for (int i = 0; i < size(); i++) { dest[i] = LongColumnType.missingValueIndicator(); } long[] array = data.toLongArray(); System.arraycopy(array, srcPos, dest, destPos, length); return new LongColumn(name() + " lag(" + n + ")", new LongArrayList(dest)); }
private static long[] filterLongs(LongSet longSet, long[] source) { LongList longList = new LongArrayList(); for (long value : source) { if (longSet.contains(value)) { longList.add(value); } } if (longList.size() == source.length) { return source; } else { return longList.toLongArray(); } }
private static LongArrayList addresses() { LongArrayList addresses = new LongArrayList(); for (int i = 0; i < TEST_PAGE.getPositionCount(); ++i) { addresses.add(encodeSyntheticAddress(0, i)); } return addresses; } }
@Override public LongColumn bottom(final int n) { final LongArrayList bottom = new LongArrayList(); final long[] values = data.toLongArray(); LongArrays.parallelQuickSort(values); for (int i = 0; i < n && i < values.length; i++) { bottom.add(values[i]); } return new LongColumn(name() + "[Bottoms " + n + "]", bottom); }
@Override public LongColumn top(int n) { final LongArrayList top = new LongArrayList(); final long[] values = data.toLongArray(); LongArrays.parallelQuickSort(values, descendingComparator); for (int i = 0; i < n && i < values.length; i++) { top.add(values[i]); } return new LongColumn(name() + "[Top " + n + "]", top); }
protected AbstractGroupCollectionAggregationState(PageBuilder pageBuilder) { this.headBlockIndex = new ShortBigArray(NULL); this.headPosition = new IntBigArray(NULL); this.nextBlockIndex = new ShortBigArray(NULL); this.nextPosition = new IntBigArray(NULL); this.tailBlockIndex = new ShortBigArray(NULL); this.tailPosition = new IntBigArray(NULL); this.currentPageBuilder = pageBuilder; this.values = new ArrayList<>(); this.sumPositions = new LongArrayList(); this.groupEntryCount = new IntBigArray(); values.add(currentPageBuilder); sumPositions.add(0L); valueBlocksRetainedSizeInBytes = 0; totalPositions = 0; capacity = 1024; nextBlockIndex.ensureCapacity(capacity); nextPosition.ensureCapacity(capacity); groupEntryCount.ensureCapacity(capacity); }
private LongList getTimers(Node<?, ?> sentinel) { LongList timers = new LongArrayList(); for (Node<?, ?> node = sentinel.getNextInVariableOrder(); node != sentinel; node = node.getNextInVariableOrder()) { timers.add(node.getVariableTime()); } return timers; }
/** Broadcast the trace events to all of the policy actors. */ private void broadcast() { try (LongStream events = eventStream()) { LongArrayList batch = new LongArrayList(batchSize); for (PrimitiveIterator.OfLong i = events.iterator(); i.hasNext();) { batch.add(i.nextLong()); if (batch.size() == batchSize) { router.route(batch, self()); batch = new LongArrayList(batchSize); } } router.route(batch, self()); router.route(FINISH, self()); } catch (Exception e) { context().system().log().error(e, ""); context().stop(self()); } }