public Pair readPair() { if (length == -1 || numRead < length) { numRead++; return decompressor.readPair(); } else { return null; } } }
private void next() { // TODO I could implement a non-streaming solution also.. is there ever a need for streaming solution? if(storedTimestamp == 0) { first(); return; } nextTimestamp(); }
/** * Returns the next pair in the time series, if available. * * @return Pair if there's next value, null if series is done. */ public Pair readPair() { next(); if(endOfStream) { return null; } Pair pair = new Pair(storedTimestamp, storedVal); return pair; }
@Benchmark @OperationsPerInvocation(100000) public void decodingGorillaBenchmark(DataGenerator dg, Blackhole bh) throws Exception { LongArrayInput input = new LongArrayInput(dg.compressedArray); GorillaDecompressor d = new GorillaDecompressor(input); Pair pair; while((pair = d.readPair()) != null) { bh.consume(pair); } } }
public List<WrappedGorillaDecompressor> getDecompressors(long begin, long end) { List<WrappedGorillaDecompressor> decompressors = new ArrayList<>(); long stamp = archivedCompressorLock.readLock(); try { for (WrappedGorillaCompressor r : archivedCompressors) { if (r.inRange(begin, end)) { GorillaDecompressor d = new GorillaDecompressor(new LongArrayInput(r.getCompressorOutput())); // use -1 length since this compressor is closed decompressors.add(new WrappedGorillaDecompressor(d, -1)); } } } finally { archivedCompressorLock.unlockRead(stamp); } // as long as begin is inRange, we should use the data in the current // compressor as well stamp = currentCompressorLock.readLock(); try { if (current != null && current.inRange(begin, end)) { LongArrayInput decompressorByteBufferInput = new LongArrayInput(current.getCompressorOutput()); GorillaDecompressor d = new GorillaDecompressor(decompressorByteBufferInput); WrappedGorillaDecompressor wd = new WrappedGorillaDecompressor(d, current.getNumEntries()); decompressors.add(wd); } } finally { currentCompressorLock.unlockRead(stamp); } return decompressors; }
public GorillaDecompressor(BitInput input, Predictor predictor) { in = input; readHeader(); this.decompressor = new ValueDecompressor(input, predictor); }
deltaDelta = decodeZigZag32((int) deltaDelta); storedDelta = storedDelta + deltaDelta;
@Benchmark @OperationsPerInvocation(100000) public void decodingGorillaBenchmark(DataGenerator dg, Blackhole bh) throws Exception { LongArrayInput input = new LongArrayInput(dg.compressedArray); GorillaDecompressor d = new GorillaDecompressor(input); Pair pair; while((pair = d.readPair()) != null) { bh.consume(pair); } } }
public GorillaDecompressor(BitInput input, Predictor predictor) { in = input; readHeader(); this.decompressor = new ValueDecompressor(input, predictor); }
deltaDelta = decodeZigZag32((int) deltaDelta); storedDelta = storedDelta + deltaDelta;
private void next() { // TODO I could implement a non-streaming solution also.. is there ever a need for streaming solution? if(storedTimestamp == 0) { first(); return; } nextTimestamp(); }
/** * Returns the next pair in the time series, if available. * * @return Pair if there's next value, null if series is done. */ public Pair readPair() { next(); if(endOfStream) { return null; } Pair pair = new Pair(storedTimestamp, storedVal); return pair; }