/** * SingleRowIter must be passed a PeekingIterator so that it can peek at the next entry to see * if it belongs in the current row or not. */ public SingleRowIter(PeekingIterator<Entry<Key,Value>> source) { this.source = source; if (source.hasNext()) currentRow = source.peek().getKey().getRow(); }
private Entry<Key,Value> _next() { if (currentRow == null) throw new NoSuchElementException(); count++; Entry<Key,Value> kv = source.next(); if (!source.hasNext() || !source.peek().getKey().getRow().equals(currentRow)) { currentRow = null; } return kv; }
@Override public boolean next(Text key, PeekingIterator<Entry<Key,Value>> value) throws IOException { if (!rowIterator.hasNext()) return false; value.initialize(rowIterator.next()); numKeysRead = rowIterator.getKVCount(); key.set((currentKey = value.peek().getKey()).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; } };
Master master, long tid) throws Exception { PeekingIterator<Map.Entry<KeyExtent,Bulk.Files>> lmi = new PeekingIterator<>(loadMapIter); Map.Entry<KeyExtent,Bulk.Files> loadMapEntry = lmi.peek();
@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 Key getTopKey() { return hasTop() ? inner.peek().getKey() : null; }
@Override public Value getTopValue() { return hasTop() ? inner.peek().getValue() : null; } }
@Override public Vertex next(PeekingIterator<Entry<Key, Value>> iterator) { // TODO could also check local cache before creating a new instance? String rowId = iterator.peek().getKey().getRow().toString(); List<Entry<Key, Value>> entries = new ArrayList<Entry<Key, Value>>(); while (iterator.peek() != null && rowId.equals(iterator .peek().getKey().getRow().toString())) { entries.add(iterator.next()); } AccumuloVertex vertex = parser.parse(rowId, entries); globals.getCaches().cache(vertex, Vertex.class); return vertex; } };
private Entry<Key,Value> _next() { if (currentRow == null) throw new NoSuchElementException(); count++; Entry<Key,Value> kv = source.next(); if (!source.hasNext() || !source.peek().getKey().getRow().equals(currentRow)) { currentRow = null; } return kv; }
@Override public boolean hasTop() { if (!inner.hasNext()) return false; Key k = inner.peek().getKey(); return seekRng.contains(k); // do not return entries past the seek() range }
/** * SingleRowIter must be passed a PeekingIterator so that it can peek at the next entry to see * if it belongs in the current row or not. */ public SingleRowIter(PeekingIterator<Entry<Key,Value>> source) { this.source = source; if (source.hasNext()) currentRow = source.peek().getKey().getRow(); }
@Override public Vertex next(PeekingIterator<Entry<Key, Value>> iterator) { // TODO could also check local cache before creating a new instance? String rowId = iterator.peek().getKey().getRow().toString(); List<Entry<Key, Value>> entries = new ArrayList<Entry<Key, Value>>(); while (iterator.peek() != null && rowId.equals(iterator .peek().getKey().getRow().toString())) { entries.add(iterator.next()); } AccumuloVertex vertex = parser.parse(rowId, entries); globals.getCaches().cache(vertex, Vertex.class); return vertex; } };
@Override public Edge next(PeekingIterator<Entry<Key, Value>> iterator) { // TODO could also check local cache before creating a new instance? String rowId = iterator.peek().getKey().getRow().toString(); List<Entry<Key, Value>> entries = new ArrayList<Entry<Key, Value>>(); // MDL 05 Jan 2014: Why is this equalsIgnoreCase?? while (iterator.peek() != null && rowId.equalsIgnoreCase(iterator .peek().getKey().getRow().toString())) { entries.add(iterator.next()); } AccumuloEdge edge = parser.parse(rowId, entries); globals.getCaches().cache(edge, Edge.class); return edge; } };
@Override public boolean next(Text key, PeekingIterator<Entry<Key,Value>> value) throws IOException { if (!rowIterator.hasNext()) return false; value.initialize(rowIterator.next()); numKeysRead = rowIterator.getKVCount(); key.set((currentKey = value.peek().getKey()).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() { 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 next(Text key, PeekingIterator<Entry<Key,Value>> value) { if (!rowIterator.hasNext()) return false; value.initialize(rowIterator.next()); numKeysRead = rowIterator.getKVCount(); key.set((currentKey = value.peek().getKey()).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 next(Text key, PeekingIterator<Entry<Key,Value>> value) throws IOException { if (!rowIterator.hasNext()) return false; value.initialize(rowIterator.next()); numKeysRead = rowIterator.getKVCount(); key.set((currentKey = value.peek().getKey()).getRow()); return true; }