Search in sources :

Example 6 with ColumnFamilySkippingIterator

use of org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator in project accumulo by apache.

the class CollectTabletStats method createScanIterator.

private static SortedKeyValueIterator<Key, Value> createScanIterator(KeyExtent ke, Collection<SortedKeyValueIterator<Key, Value>> mapfiles, Authorizations authorizations, byte[] defaultLabels, HashSet<Column> columnSet, List<IterInfo> ssiList, Map<String, Map<String, String>> ssio, boolean useTableIterators, TableConfiguration conf) throws IOException {
    SortedMapIterator smi = new SortedMapIterator(new TreeMap<>());
    List<SortedKeyValueIterator<Key, Value>> iters = new ArrayList<>(mapfiles.size() + 1);
    iters.addAll(mapfiles);
    iters.add(smi);
    MultiIterator multiIter = new MultiIterator(iters, ke);
    DeletingIterator delIter = new DeletingIterator(multiIter, false);
    ColumnFamilySkippingIterator cfsi = new ColumnFamilySkippingIterator(delIter);
    SortedKeyValueIterator<Key, Value> colFilter = ColumnQualifierFilter.wrap(cfsi, columnSet);
    SortedKeyValueIterator<Key, Value> visFilter = VisibilityFilter.wrap(colFilter, authorizations, defaultLabels);
    if (useTableIterators)
        return IteratorUtil.loadIterators(IteratorScope.scan, visFilter, ke, conf, ssiList, ssio, null);
    return visFilter;
}
Also used : ColumnFamilySkippingIterator(org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator) MultiIterator(org.apache.accumulo.core.iterators.system.MultiIterator) ArrayList(java.util.ArrayList) Value(org.apache.accumulo.core.data.Value) SortedKeyValueIterator(org.apache.accumulo.core.iterators.SortedKeyValueIterator) DeletingIterator(org.apache.accumulo.core.iterators.system.DeletingIterator) SortedMapIterator(org.apache.accumulo.core.iterators.SortedMapIterator) Key(org.apache.accumulo.core.data.Key)

Example 7 with ColumnFamilySkippingIterator

use of org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator in project accumulo by apache.

the class IteratorUtil method setupSystemScanIterators.

public static SortedKeyValueIterator<Key, Value> setupSystemScanIterators(SortedKeyValueIterator<Key, Value> source, Set<Column> cols, Authorizations auths, byte[] defaultVisibility) throws IOException {
    DeletingIterator delIter = new DeletingIterator(source, false);
    ColumnFamilySkippingIterator cfsi = new ColumnFamilySkippingIterator(delIter);
    SortedKeyValueIterator<Key, Value> colFilter = ColumnQualifierFilter.wrap(cfsi, cols);
    return VisibilityFilter.wrap(colFilter, auths, defaultVisibility);
}
Also used : ColumnFamilySkippingIterator(org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator) Value(org.apache.accumulo.core.data.Value) DeletingIterator(org.apache.accumulo.core.iterators.system.DeletingIterator) Key(org.apache.accumulo.core.data.Key)

Example 8 with ColumnFamilySkippingIterator

use of org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator in project accumulo by apache.

the class RowDeletingIteratorTest method test3.

public void test3() throws Exception {
    TreeMap<Key, Value> tm1 = new TreeMap<>();
    put(tm1, "r1", "", "", 10, RowDeletingIterator.DELETE_ROW_VALUE);
    put(tm1, "r1", "", "cq1", 5, "v1");
    put(tm1, "r1", "cf1", "cq1", 5, "v1");
    put(tm1, "r2", "", "cq1", 5, "v1");
    put(tm1, "r2", "cf1", "cq1", 5, "v1");
    RowDeletingIterator rdi = new RowDeletingIterator();
    rdi.init(new ColumnFamilySkippingIterator(new SortedMapIterator(tm1)), null, new TestIE(IteratorScope.scan, false));
    HashSet<ByteSequence> cols = new HashSet<>();
    cols.add(new ArrayByteSequence("cf1".getBytes()));
    rdi.seek(new Range(), cols, true);
    testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
    cols.clear();
    cols.add(new ArrayByteSequence("".getBytes()));
    rdi.seek(new Range(), cols, false);
    testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
    cols.clear();
    rdi.seek(new Range(), cols, false);
    testAssertions(rdi, "r2", "", "cq1", 5, "v1");
    rdi.next();
    testAssertions(rdi, "r2", "cf1", "cq1", 5, "v1");
}
Also used : ColumnFamilySkippingIterator(org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator) TreeMap(java.util.TreeMap) SortedMapIterator(org.apache.accumulo.core.iterators.SortedMapIterator) Range(org.apache.accumulo.core.data.Range) Value(org.apache.accumulo.core.data.Value) ArrayByteSequence(org.apache.accumulo.core.data.ArrayByteSequence) Key(org.apache.accumulo.core.data.Key) ByteSequence(org.apache.accumulo.core.data.ByteSequence) ArrayByteSequence(org.apache.accumulo.core.data.ArrayByteSequence) HashSet(java.util.HashSet)

Example 9 with ColumnFamilySkippingIterator

use of org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator in project accumulo by apache.

the class RowFilterTest method test1.

@Test
public void test1() throws Exception {
    ColumnFamilySkippingIterator source = new ColumnFamilySkippingIterator(new SortedMapIterator(createKeyValues()));
    RowFilter filter = new SummingRowFilter();
    filter.init(source, Collections.emptyMap(), new DefaultIteratorEnvironment());
    filter.seek(new Range(), Collections.emptySet(), false);
    assertEquals(new HashSet<>(Arrays.asList("2", "3")), getRows(filter));
    ByteSequence cf = new ArrayByteSequence("cf2");
    filter.seek(new Range(), ImmutableSet.of(cf), true);
    assertEquals(new HashSet<>(Arrays.asList("1", "3", "0", "4")), getRows(filter));
    filter.seek(new Range("0", "4"), Collections.emptySet(), false);
    assertEquals(new HashSet<>(Arrays.asList("2", "3")), getRows(filter));
    filter.seek(new Range("2"), Collections.emptySet(), false);
    assertEquals(new HashSet<>(Arrays.asList("2")), getRows(filter));
    filter.seek(new Range("4"), Collections.emptySet(), false);
    assertEquals(new HashSet<String>(), getRows(filter));
    filter.seek(new Range("4"), ImmutableSet.of(cf), true);
    assertEquals(new HashSet<>(Arrays.asList("4")), getRows(filter));
}
Also used : ColumnFamilySkippingIterator(org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator) DefaultIteratorEnvironment(org.apache.accumulo.core.iterators.DefaultIteratorEnvironment) ArrayByteSequence(org.apache.accumulo.core.data.ArrayByteSequence) SortedMapIterator(org.apache.accumulo.core.iterators.SortedMapIterator) Range(org.apache.accumulo.core.data.Range) ByteSequence(org.apache.accumulo.core.data.ByteSequence) ArrayByteSequence(org.apache.accumulo.core.data.ArrayByteSequence) Test(org.junit.Test)

Example 10 with ColumnFamilySkippingIterator

use of org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator in project accumulo by apache.

the class TransformingIteratorTest method setUpTransformIterator.

private void setUpTransformIterator(Class<? extends TransformingIterator> clazz, boolean setupAuths) throws IOException {
    SortedMapIterator source = new SortedMapIterator(data);
    ColumnFamilySkippingIterator cfsi = new ColumnFamilySkippingIterator(source);
    SortedKeyValueIterator<Key, Value> visFilter = VisibilityFilter.wrap(cfsi, authorizations, new byte[0]);
    ReuseIterator reuserIter = new ReuseIterator();
    reuserIter.init(visFilter, EMPTY_OPTS, null);
    try {
        titer = clazz.newInstance();
    } catch (InstantiationException | IllegalAccessException e) {
        throw new RuntimeException(e);
    }
    IteratorEnvironment iterEnv = EasyMock.createMock(IteratorEnvironment.class);
    EasyMock.expect(iterEnv.getIteratorScope()).andReturn(IteratorScope.scan).anyTimes();
    EasyMock.replay(iterEnv);
    Map<String, String> opts;
    if (setupAuths) {
        IteratorSetting cfg = new IteratorSetting(21, clazz);
        TransformingIterator.setAuthorizations(cfg, new Authorizations("vis0", "vis1", "vis2", "vis3"));
        opts = cfg.getOptions();
    } else {
        opts = ImmutableMap.of();
    }
    titer.init(reuserIter, opts, iterEnv);
}
Also used : ColumnFamilySkippingIterator(org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator) Authorizations(org.apache.accumulo.core.security.Authorizations) BaseIteratorEnvironment(org.apache.accumulo.core.client.impl.BaseIteratorEnvironment) IteratorEnvironment(org.apache.accumulo.core.iterators.IteratorEnvironment) SortedMapIterator(org.apache.accumulo.core.iterators.SortedMapIterator) IteratorSetting(org.apache.accumulo.core.client.IteratorSetting) Value(org.apache.accumulo.core.data.Value) Key(org.apache.accumulo.core.data.Key) PartialKey(org.apache.accumulo.core.data.PartialKey)

Aggregations

ColumnFamilySkippingIterator (org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator)10 Key (org.apache.accumulo.core.data.Key)6 Value (org.apache.accumulo.core.data.Value)6 SortedMapIterator (org.apache.accumulo.core.iterators.SortedMapIterator)5 Range (org.apache.accumulo.core.data.Range)4 DeletingIterator (org.apache.accumulo.core.iterators.system.DeletingIterator)4 ArrayList (java.util.ArrayList)3 ArrayByteSequence (org.apache.accumulo.core.data.ArrayByteSequence)3 ByteSequence (org.apache.accumulo.core.data.ByteSequence)3 IteratorSetting (org.apache.accumulo.core.client.IteratorSetting)2 AccumuloConfiguration (org.apache.accumulo.core.conf.AccumuloConfiguration)2 SortedKeyValueIterator (org.apache.accumulo.core.iterators.SortedKeyValueIterator)2 MultiIterator (org.apache.accumulo.core.iterators.system.MultiIterator)2 Test (org.junit.Test)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 DataInputStream (java.io.DataInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 HashSet (java.util.HashSet)1