@Test public void testDeepCopy() throws Exception { ColumnVisibility vis1 = new ColumnVisibility("vis1"); ColumnVisibility vis3 = new ColumnVisibility("vis3"); data.clear(); Value ev = new Value(""); data.put(new Key("shard001", "foo", "doc02", vis1, 78), ev); data.put(new Key("shard001", "dog", "doc02", vis3, 78), ev); data.put(new Key("shard001", "cat", "doc02", vis3, 78), ev); data.put(new Key("shard001", "bar", "doc03", vis1, 78), ev); data.put(new Key("shard001", "dog", "doc03", vis3, 78), ev); data.put(new Key("shard001", "cat", "doc03", vis3, 78), ev); setUpTransformIterator(ColVisReversingKeyTransformingIterator.class); IntersectingIterator iiIter = new IntersectingIterator(); IteratorSetting iicfg = new IteratorSetting(22, IntersectingIterator.class); IntersectingIterator.setColumnFamilies(iicfg, new Text[] {new Text("foo"), new Text("dog"), new Text("cat")}); iiIter.init(titer, iicfg.getOptions(), null); iiIter.seek(new Range(), new HashSet<>(), false); assertTrue(iiIter.hasTop()); Key docKey = iiIter.getTopKey(); assertEquals("shard001", docKey.getRowData().toString()); assertEquals("doc02", docKey.getColumnQualifierData().toString()); iiIter.next(); assertFalse(iiIter.hasTop()); }
@Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { TransformingIterator copy; try { copy = getClass().getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException(e); } copy.setSource(getSource().deepCopy(env)); copy.scanning = scanning; copy.keyPos = keyPos; copy.keys.addAll(keys); copy.seekRange = (seekRange == null) ? null : new Range(seekRange); copy.seekColumnFamilies = (seekColumnFamilies == null) ? null : new HashSet<>(seekColumnFamilies); copy.seekColumnFamiliesInclusive = seekColumnFamiliesInclusive; copy.ve = ve; if (visibleCache != null) { copy.visibleCache = new LRUMap<>(visibleCache.maxSize()); copy.visibleCache.putAll(visibleCache); } if (parsedVisibilitiesCache != null) { copy.parsedVisibilitiesCache = new LRUMap<>(parsedVisibilitiesCache.maxSize()); copy.parsedVisibilitiesCache.putAll(parsedVisibilitiesCache); } copy.maxBufferSize = maxBufferSize; return copy; }
TransformingIterator extends WrappingIterator implements OptionDescriber { @Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { TransformingIterator copy; try { copy = getClass().getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException(e); } copy.setSource(getSource().deepCopy(env)); copy.scanning = scanning; copy.keyPos = keyPos; copy.keys.addAll(keys); copy.seekRange = (seekRange == null) ? null : new Range(seekRange); copy.seekColumnFamilies = (seekColumnFamilies == null) ? null : new HashSet<>(seekColumnFamilies); copy.seekColumnFamiliesInclusive = seekColumnFamiliesInclusive; copy.ve = ve; if (visibleCache != null) { copy.visibleCache = new LRUMap<>(visibleCache.maxSize()); copy.visibleCache.putAll(visibleCache); } if (parsedVisibilitiesCache != null) { copy.parsedVisibilitiesCache = new LRUMap<>(parsedVisibilitiesCache.maxSize()); copy.parsedVisibilitiesCache.putAll(parsedVisibilitiesCache); } copy.maxBufferSize = maxBufferSize; return copy; } }
TransformingIterator extends WrappingIterator implements OptionDescriber { @Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { TransformingIterator copy; try { copy = getClass().getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException(e); } copy.setSource(getSource().deepCopy(env)); copy.scanning = scanning; copy.keyPos = keyPos; copy.keys.addAll(keys); copy.seekRange = (seekRange == null) ? null : new Range(seekRange); copy.seekColumnFamilies = (seekColumnFamilies == null) ? null : new HashSet<>(seekColumnFamilies); copy.seekColumnFamiliesInclusive = seekColumnFamiliesInclusive; copy.ve = ve; if (visibleCache != null) { copy.visibleCache = new LRUMap<>(visibleCache.maxSize()); copy.visibleCache.putAll(visibleCache); } if (parsedVisibilitiesCache != null) { copy.parsedVisibilitiesCache = new LRUMap<>(parsedVisibilitiesCache.maxSize()); copy.parsedVisibilitiesCache.putAll(parsedVisibilitiesCache); } copy.maxBufferSize = maxBufferSize; return copy; }  }
TransformingIterator extends WrappingIterator implements OptionDescriber { @Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { TransformingIterator copy; try { copy = getClass().getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException(e); } copy.setSource(getSource().deepCopy(env)); copy.scanning = scanning; copy.keyPos = keyPos; copy.keys.addAll(keys); copy.seekRange = (seekRange == null) ? null : new Range(seekRange); copy.seekColumnFamilies = (seekColumnFamilies == null) ? null : new HashSet<>(seekColumnFamilies); copy.seekColumnFamiliesInclusive = seekColumnFamiliesInclusive; copy.ve = ve; if (visibleCache != null) { copy.visibleCache = new LRUMap<>(visibleCache.maxSize()); copy.visibleCache.putAll(visibleCache); } if (parsedVisibilitiesCache != null) { copy.parsedVisibilitiesCache = new LRUMap<>(parsedVisibilitiesCache.maxSize()); copy.parsedVisibilitiesCache.putAll(parsedVisibilitiesCache); } copy.maxBufferSize = maxBufferSize; return copy; }  @Override void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options,
      IteratorEnvironment env); @Override IteratorOptions describeOptions(); @Override boolean validateOptions(Map<String,String> options); @Override SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env); @Override boolean hasTop(); @Override Key getTopKey(); @Override Value getTopValue(); @Override void next(); @Override void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive); static void setAuthorizations(IteratorSetting config, Authorizations auths); static void setMaxBufferSize(IteratorSetting config, long maxBufferSize); }
TransformingIterator extends WrappingIterator implements OptionDescriber { @Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { TransformingIterator copy; try { copy = getClass().getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException(e); } copy.setSource(getSource().deepCopy(env)); copy.scanning = scanning; copy.keyPos = keyPos; copy.keys.addAll(keys); copy.seekRange = (seekRange == null) ? null : new Range(seekRange); copy.seekColumnFamilies = (seekColumnFamilies == null) ? null : new HashSet<>(seekColumnFamilies); copy.seekColumnFamiliesInclusive = seekColumnFamiliesInclusive; copy.ve = ve; if (visibleCache != null) { copy.visibleCache = new LRUMap<>(visibleCache.maxSize()); copy.visibleCache.putAll(visibleCache); } if (parsedVisibilitiesCache != null) { copy.parsedVisibilitiesCache = new LRUMap<>(parsedVisibilitiesCache.maxSize()); copy.parsedVisibilitiesCache.putAll(parsedVisibilitiesCache); } copy.maxBufferSize = maxBufferSize; return copy; }  @Override void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options,
      IteratorEnvironment env); @Override IteratorOptions describeOptions(); @Override boolean validateOptions(Map<String,String> options); @Override SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env); @Override boolean hasTop(); @Override Key getTopKey(); @Override Value getTopValue(); @Override void next(); @Override void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive); static void setAuthorizations(IteratorSetting config, Authorizations auths); static void setMaxBufferSize(IteratorSetting config, long maxBufferSize); static final String AUTH_OPT; static final String MAX_BUFFER_SIZE_OPT; }