/** * Create an iterator from an (ordered) sequence of KeyValue pairs. */ public RowIterator(Iterator<Entry<Key,Value>> iterator) { this.iter = new PeekingIterator<>(iterator); }
@Override public PeekingIterator<Entry<Key,Value>> createValue() { return new PeekingIterator<>(); } };
@Override public boolean nextKeyValue() throws IOException, InterruptedException { if (!rowIterator.hasNext()) return false; currentV = new PeekingIterator<>(rowIterator.next()); numKeysRead = rowIterator.getKVCount(); currentKey = currentV.peek().getKey(); currentK = new Text(currentKey.getRow()); return true; } };
PeekingIterator<Map.Entry<KeyExtent,Bulk.Files>> lmi = new PeekingIterator<>(loadMapIter); Map.Entry<KeyExtent,Bulk.Files> loadMapEntry = lmi.peek();
@Override public PeekingIterator<Entry<Key,Value>> createValue() { return new PeekingIterator<>(); } };
@Override public PeekingIterator<Entry<Key,Value>> createValue() { return new PeekingIterator<>(); } };
/** * Create an iterator from an (ordered) sequence of KeyValue pairs. */ public RowIterator(Iterator<Entry<Key,Value>> iterator) { this.iter = new PeekingIterator<>(iterator); }
@Override public PeekingIterator<Entry<Key,Value>> createValue() { return new PeekingIterator<>(); } };
@Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { HardListIterator newInstance; try { newInstance = HardListIterator.class.newInstance(); } catch (Exception e) { throw new RuntimeException(e); } newInstance.inner = new PeekingIterator<>( allEntriesToInject.tailMap(inner.peek().getKey()).entrySet().iterator()); return newInstance; }
@Override public Iterator<T> iterator() { return new ScannerIterator(new PeekingIterator<Entry<Key,Value>>(scanner.iterator())); }
public ShardLimitingIterator(Iterator<Entry<Key,Value>> kvIter, int maxShardsPerDay) { this.kvIter = new PeekingIterator<>(kvIter); this.maxShardsPerDay = maxShardsPerDay; currentQueue = Queues.newArrayDeque(); }
@Override public Iterator<T> iterator() { return new ScannerIterator(new PeekingIterator<Entry<Key,Value>>(scanner.iterator())); }
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { if (source != null) log.info("HardListIterator ignores/replaces parent source passed in init(): " + source); IteratorUtil.IteratorScope scope = env.getIteratorScope(); log.debug(this.getClass() + ": init on scope " + scope + (scope == IteratorUtil.IteratorScope.majc ? " fullScan=" + env.isFullMajorCompaction() : "")); // define behavior before seek as seek to start at negative infinity inner = new PeekingIterator<>(allEntriesToInject.entrySet().iterator()); }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { seekRng = range; // seek to first entry inside range if (range.isInfiniteStartKey()) inner = new PeekingIterator<>(allEntriesToInject.entrySet().iterator()); else if (range.isStartKeyInclusive()) inner = new PeekingIterator<>( allEntriesToInject.tailMap(range.getStartKey()).entrySet().iterator()); else inner = new PeekingIterator<>(allEntriesToInject .tailMap(range.getStartKey().followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME)) .entrySet().iterator()); }
@Override public void initialize(InputSplit inSplit, TaskAttemptContext attempt) throws IOException { super.initialize(inSplit, attempt); peekingScannerIterator = new PeekingIterator<Entry<Key,Value>>(scannerIterator); currentK = new ArrayList<Entry<Key,Value>>(); currentV = new ChunkInputStream(); }
@Override public boolean nextKeyValue() { if (!rowIterator.hasNext()) return false; currentV = new PeekingIterator<>(rowIterator.next()); numKeysRead = rowIterator.getKVCount(); currentKey = currentV.peek().getKey(); currentK = new Text(currentKey.getRow()); return true; } };
@Override public boolean nextKeyValue() throws IOException, InterruptedException { if (!rowIterator.hasNext()) return false; currentV = new PeekingIterator<>(rowIterator.next()); numKeysRead = rowIterator.getKVCount(); currentKey = currentV.peek().getKey(); currentK = new Text(currentKey.getRow()); return true; } };
@Override public boolean nextKeyValue() throws IOException, InterruptedException { if (!rowIterator.hasNext()) return false; currentV = new PeekingIterator<>(rowIterator.next()); numKeysRead = rowIterator.getKVCount(); currentKey = currentV.peek().getKey(); currentK = new Text(currentKey.getRow()); return true; } };
public ChunkInputStream getData(String hash) throws IOException { scanner.setRange(new Range(hash)); scanner.setBatchSize(1); lastRefs.clear(); PeekingIterator<Entry<Key,Value>> pi = new PeekingIterator<Entry<Key,Value>>(scanner.iterator()); if (pi.hasNext()) { while (!pi.peek().getKey().getColumnFamily().equals(FileDataIngest.CHUNK_CF)) { lastRefs.add(pi.peek()); pi.next(); } } cis.clear(); cis.setSource(pi); return cis; }
PeekingIterator<Entry<Key,Value>> row = new PeekingIterator<>(iter.next()); Entry<Key,Value> kv = null; if (row.hasNext())