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; }
loadMapEntry = lmi.next(); List<TabletMetadata> tablets = findOverlappingTablets(loadMapEntry.getKey(), tabletIter); loader.load(tablets, loadMapEntry.getValue());
@Override public void next() throws IOException { inner.next(); }
@Override public T next(PeekingIterator<Entry<Key,Value>> iterator) { return (T) parser.parse(Arrays.asList(iterator.next())); } };
@Override public T next(PeekingIterator<Entry<Key,Value>> iterator) { return (T) parser.parse(Arrays.asList(iterator.next())); } };
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 Vertex next(PeekingIterator<Entry<Key,Value>> iterator) { // TODO better use of information readily available... // TODO could also check local cache before creating a new // instance? String[] parts = iterator.next().getKey().getColumnQualifier() .toString().split(Constants.ID_DELIM); AccumuloVertex vertex = new AccumuloVertex(globals, parts[0]); globals.getCaches().cache(vertex, Vertex.class); return vertex; } };
@Override public Vertex next(PeekingIterator<Entry<Key,Value>> iterator) { // TODO better use of information readily available... // TODO could also check local cache before creating a new // instance? String[] parts = iterator.next().getKey().getColumnQualifier() .toString().split(Constants.ID_DELIM); AccumuloVertex vertex = new AccumuloVertex(globals, parts[0]); globals.getCaches().cache(vertex, Vertex.class); return vertex; } };
/** * Pulls the Key-Value pairs representing the next row from the supplied <code>PeekingIterator</code> and returns * them as a <code>SortedMap</code> * * @param row * @return */ public static SortedMap<Key, Value> buildRowMap(PeekingIterator<Entry<Key, Value>> row) { TreeMap<Key, Value> aggregatedRow = new TreeMap<>(); Text rowid = null; while (row.hasNext() && (rowid == null || rowid.equals(row.peek().getKey().getRow()))) { Entry<Key, Value> entry = row.next(); if (rowid == null) { rowid = entry.getKey().getRow(); } aggregatedRow.put(entry.getKey(), entry.getValue()); } return aggregatedRow; }
@Override protected void safeMap(Text row, PeekingIterator<Map.Entry<Key, Value>> value, Context context) throws IOException, InterruptedException { context.setStatus(row.toString()); String propertyVisibility = null; while (value.hasNext()) { Map.Entry<Key, Value> column = value.next(); if (column.getKey().getColumnFamily().toString().equals("PROP")) { propertyVisibility = AccumuloGraph.accumuloVisibilityToVisibility(column.getKey().getColumnVisibilityParsed()).getVisibilityString(); } else if (column.getKey().getColumnFamily().toString().equals("PROPMETA")) { updateMetadata(column.getKey(), column.getValue(), propertyVisibility, context); } } }
@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 Edge next(PeekingIterator<Entry<Key,Value>> iterator) { Key k = iterator.next().getKey(); if (k.getColumnFamily().toString().equals(Constants.LABEL)) { String[] vals = k.getColumnQualifier().toString().split(Constants.ID_DELIM); return new AccumuloEdge(globals, k.getRow().toString(), new AccumuloVertex(globals, vals[0]), new AccumuloVertex(globals, vals[1]), null); } return new AccumuloEdge(globals, k.getRow().toString()); } };
@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) { Key k = iterator.next().getKey(); if (k.getColumnFamily().toString().equals(Constants.LABEL)) { String[] vals = k.getColumnQualifier().toString().split(Constants.ID_DELIM); return new AccumuloEdge(globals, k.getRow().toString(), new AccumuloVertex(globals, vals[0]), new AccumuloVertex(globals, vals[1]), null); } return new AccumuloEdge(globals, k.getRow().toString()); } };
@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 Vertex next(PeekingIterator<Entry<Key,Value>> iterator) { Entry<Key, Value> kv = iterator.next(); String key = kv.getKey().getColumnFamily().toString(); Object value = AccumuloByteSerializer.deserialize(kv.getValue().get()); Vertex v = globals.getCaches().retrieve(kv.getKey().getRow().toString(), Vertex.class); if (v == null) { v = new AccumuloVertex(globals, kv.getKey().getRow().toString()); } ((AccumuloElement) v).setPropertyInMemory(key, value); globals.getCaches().cache(v, Vertex.class); return v; } };
@Override public Vertex next(PeekingIterator<Entry<Key,Value>> iterator) { Entry<Key, Value> kv = iterator.next(); String key = kv.getKey().getColumnFamily().toString(); Object value = AccumuloByteSerializer.deserialize(kv.getValue().get()); Vertex v = globals.getCaches().retrieve(kv.getKey().getRow().toString(), Vertex.class); if (v == null) { v = new AccumuloVertex(globals, kv.getKey().getRow().toString()); } ((AccumuloElement) v).setPropertyInMemory(key, value); globals.getCaches().cache(v, Vertex.class); return v; } };
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; }
@Override public Vertex next(PeekingIterator<Entry<Key, Value>> iterator) { Entry<Key, Value> entry = iterator.next(); AccumuloVertex v = parser.parse(Arrays.asList(entry)); // Check if we have it cached already, in which // case use the cached version. AccumuloVertex cached = (AccumuloVertex) globals.getCaches() .retrieve(v.getId(), Vertex.class); if (cached != null) { for (String key : v.getPropertyKeysInMemory()) { cached.setPropertyInMemory(key, v.getPropertyInMemory(key)); } return cached; } // We don't have it, so cache the new one and return it. globals.getCaches().cache(v, Vertex.class); return v; } };