public int getPositionCount() { return addresses.size(); }
@Override public int size() { return data.size(); }
public int size() { return data.size(); }
public long count() { return allFps.size(); }
/** * Returns an array where each entry is the difference, measured in milliseconds, * between the LocalDateTime and midnight, January 1, 1970 UTC. * * If a missing value is encountered, Long.MIN_VALUE is inserted in the array */ public long[] asEpochMillisArray(ZoneOffset offset) { long[] output = new long[data.size()]; for (int i = 0; i < data.size(); i++) { LocalDateTime dateTime = PackedLocalDateTime.asLocalDateTime(data.getLong(i)); if (dateTime == null) { output[i] = Long.MIN_VALUE; } else { output[i] = dateTime.toInstant(offset).toEpochMilli(); } } return output; }
/** * Returns the seconds from epoch for each value as an array based on the given offset * * If a value is missing, Long.MIN_VALUE is used */ public long[] asEpochSecondArray(ZoneOffset offset) { long[] output = new long[data.size()]; for (int i = 0; i < data.size(); i++) { LocalDateTime dateTime = PackedLocalDateTime.asLocalDateTime(data.getLong(i)); if (dateTime == null) { output[i] = Long.MIN_VALUE; } else { output[i] = dateTime.toEpochSecond(offset); } } return output; }
@Override public DateTimeColumn copy() { DateTimeColumn column = emptyCopy(data.size()); column.data = data.clone(); return column; }
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
int hashSize = HashCommon.arraySize(addresses.size(), 0.75f); Arrays.fill(key, -1); positionToHashes = new byte[addresses.size()]; int positionsInStep = Math.min(addresses.size() + 1, (int) CACHE_SIZE.toBytes() / Integer.SIZE); long[] positionToFullHashes = new long[positionsInStep]; long hashCollisionsLocal = 0; for (int step = 0; step * positionsInStep <= addresses.size(); step++) { int stepBeginPosition = step * positionsInStep; int stepEndPosition = Math.min((step + 1) * positionsInStep, addresses.size()); int stepSize = stepEndPosition - stepBeginPosition; sizeOf(key) + sizeOf(positionToHashes); hashCollisions = hashCollisionsLocal; expectedHashCollisions = estimateNumberOfHashCollisions(addresses.size(), hashSize);
@Override public int countUnique() { LongSet ints = new LongOpenHashSet(data.size()); for (long i : data) { ints.add(i); } return ints.size(); }
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; } } }
protected LongIterator beginFpMerge() { newFps = new LongArrayList((int) (allFps.size()+(pending()/2))); return allFps.iterator(); }
Operator relateOperator = OperatorFactoryLocal.getInstance().getOperator(Operator.Type.Relate); for (int position = 0; position < addresses.size(); position++) { long pageAddress = addresses.getLong(position); int blockIndex = decodeSliceIndex(pageAddress);
private void process(LongArrayList events) { try { policy.stats().stopwatch().start(); for (int i = 0; i < events.size(); i++) { policy.record(events.getLong(i)); } } catch (Exception e) { sender().tell(ERROR, self()); context().system().log().error(e, ""); } finally { policy.stats().stopwatch().stop(); } }
@Override public DateTimeColumn unique() { LongSet ints = new LongOpenHashSet(data.size()); for (long i : data) { ints.add(i); } DateTimeColumn column = emptyCopy(ints.size()); column.setName(name() + " Unique values"); column.data = LongArrayList.wrap(ints.toLongArray()); return column; }
@Override public int size() { return keyList.size(); }
@Override public int size() { return keyList.size(); }
/** 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()); } }