Package org.apache.accumulo.core.iterators

Examples of org.apache.accumulo.core.iterators.DefaultIteratorEnvironment


    MultiIteratorTest.nkv(tm, 2, 0, false, "2");
   
    SortedMapIterator source = new SortedMapIterator(tm);
   
    SortedKeyValueIterator<Key,Value> iter = IteratorUtil.loadIterators(IteratorScope.minc, source, new KeyExtent(new Text("tab"), null, null), conf,
        new DefaultIteratorEnvironment());
   
    assertTrue(iter.hasTop());
    assertTrue(iter.getTopKey().equals(MultiIteratorTest.nk(1, 0)));
    assertTrue(iter.getTopValue().toString().equals("4"));
   
View Full Code Here


    MultiIteratorTest.nkv(tm, 2, 0, false, "2");
   
    SortedMapIterator source = new SortedMapIterator(tm);
   
    SortedKeyValueIterator<Key,Value> iter = IteratorUtil.loadIterators(IteratorScope.majc, source, new KeyExtent(new Text("tab"), null, null), conf,
        new DefaultIteratorEnvironment());
   
    assertTrue(iter.hasTop());
    assertTrue(iter.getTopKey().equals(MultiIteratorTest.nk(1, 0)));
    assertTrue(iter.getTopValue().toString().equals("1"));
   
View Full Code Here

   
    conf.set(Property.TABLE_ITERATOR_PREFIX + IteratorScope.minc.name() + ".addIter", "2," + AddingIter.class.getName());
    conf.set(Property.TABLE_ITERATOR_PREFIX + IteratorScope.minc.name() + ".sqIter", "1," + SquaringIter.class.getName());
   
    SortedKeyValueIterator<Key,Value> iter = IteratorUtil.loadIterators(IteratorScope.minc, source, new KeyExtent(new Text("tab"), null, null), conf,
        new DefaultIteratorEnvironment());
   
    assertTrue(iter.hasTop());
    assertTrue(iter.getTopKey().equals(MultiIteratorTest.nk(1, 0)));
    assertTrue(iter.getTopValue().toString().equals("2"));
   
View Full Code Here

    MultiIteratorTest.nkv(tm, 2, 0, false, "2");
   
    SortedMapIterator source = new SortedMapIterator(tm);
   
    SortedKeyValueIterator<Key,Value> iter = IteratorUtil.loadIterators(IteratorScope.minc, source, new KeyExtent(new Text("tab"), null, null), conf,
        new DefaultIteratorEnvironment());
   
    assertTrue(iter.hasTop());
    assertTrue(iter.getTopKey().equals(MultiIteratorTest.nk(1, 0)));
    assertTrue(iter.getTopValue().toString().equals("64"));
   
View Full Code Here

    MultiIteratorTest.nkv(tm, 2, 950, false, "2");
   
    SortedMapIterator source = new SortedMapIterator(tm);
   
    SortedKeyValueIterator<Key,Value> iter = IteratorUtil.loadIterators(IteratorScope.minc, source, new KeyExtent(new Text("tab"), null, null), conf,
        new DefaultIteratorEnvironment());
   
    assertTrue(iter.hasTop());
    assertTrue(iter.getTopKey().equals(MultiIteratorTest.nk(2, 950)));
    iter.next();
   
View Full Code Here

    RegExIterator rei = new RegExIterator();
   
    HashMap<String,String> options = new HashMap<String,String>();
   
    options.put(RegExFilter.ROW_REGEX, ".*2");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k3));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put(RegExFilter.COLF_REGEX, "ya.*");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put(RegExFilter.COLQ_REGEX, ".*01");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k1));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put(RegExFilter.VALUE_REGEX, ".*at");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put(RegExFilter.VALUE_REGEX, ".*ap");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put(RegExFilter.COLF_REGEX, "ya.*");
    options.put(RegExFilter.VALUE_REGEX, ".*at");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put(RegExFilter.COLF_REGEX, "ya.*");
    options.put(RegExFilter.VALUE_REGEX, ".*ap");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put(RegExFilter.ROW_REGEX, "boo1");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k1));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertTrue(rei.hasTop());
View Full Code Here

   
    HashMap<String,String> options = new HashMap<String,String>();
   
    options.put("0", RegExFilter.class.getName());
    options.put("0." + RegExFilter.ROW_REGEX, ".*2");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k3));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put("0", RegExFilter.class.getName());
    options.put("0." + RegExFilter.COLF_REGEX, "ya.*");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put("0", RegExFilter.class.getName());
    options.put("0." + RegExFilter.COLQ_REGEX, ".*01");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k1));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put("0", RegExFilter.class.getName());
    options.put("0." + RegExFilter.VALUE_REGEX, ".*at");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put("0", RegExFilter.class.getName());
    options.put("0." + RegExFilter.VALUE_REGEX, ".*ap");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put("0", RegExFilter.class.getName());
    options.put("0." + RegExFilter.COLF_REGEX, "ya.*");
    options.put("0." + RegExFilter.VALUE_REGEX, ".*at");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put("0", RegExFilter.class.getName());
    options.put("0." + RegExFilter.COLF_REGEX, "ya.*");
    options.put("0." + RegExFilter.VALUE_REGEX, ".*ap");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put("0", RegExFilter.class.getName());
    options.put("0." + RegExFilter.ROW_REGEX, "boo1");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k1));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k1));
    rei.next();
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k3));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    options.clear();
   
    options.put("0", RegExFilter.class.getName());
    options.put("0." + RegExFilter.ROW_REGEX, "hamster");
    options.put("0." + RegExFilter.COLQ_REGEX, "hamster");
    options.put("0." + RegExFilter.VALUE_REGEX, "hamster");
    options.put("0." + RegExFilter.OR_FIELDS, "true");
    rei.init(new SortedMapIterator(tm), options, new DefaultIteratorEnvironment());
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k3));
    rei.next();
    assertFalse(rei.hasTop());
View Full Code Here

   
    Map<String,String> opts = new HashMap<String,String>();
   
    opts.put("cf001", SummationAggregator.class.getName());
   
    ai.init(new SortedMapIterator(tm1), opts, new DefaultIteratorEnvironment());
   
    // try seeking to the beginning of a key that aggregates
   
    ai.seek(nr(1, 1, 1, 3, false), EMPTY_COL_FAMS, false);
   
View Full Code Here

   
    Map<String,String> opts = new HashMap<String,String>();
   
    opts.put("cf001", SummationAggregator.class.getName());
   
    ai.init(new SortedMapIterator(tm1), opts, new DefaultIteratorEnvironment());
   
    ai.seek(nr(1, 1, 1, 4, true), EMPTY_COL_FAMS, false);
   
    assertTrue(ai.hasTop());
    assertEquals(nk(1, 1, 1, 4), ai.getTopKey());
    assertEquals("7", ai.getTopValue().toString());
   
    ai.next();
    assertTrue(ai.hasTop());
    assertEquals(nk(1, 1, 1, 2, true), ai.getTopKey());
    assertEquals("", ai.getTopValue().toString());
   
    ai.next();
    assertFalse(ai.hasTop());
   
    tm1 = new TreeMap<Key,Value>();
    nkv(tm1, 1, 1, 1, 2, true, "");
    ai = new AggregatingIterator();
    ai.init(new SortedMapIterator(tm1), opts, new DefaultIteratorEnvironment());
   
    ai.seek(nr(1, 1, 1, 4, true), EMPTY_COL_FAMS, false);
   
    assertTrue(ai.hasTop());
    assertEquals(nk(1, 1, 1, 2, true), ai.getTopKey());
View Full Code Here

   
    IteratorSetting is = new IteratorSetting(1, RegExFilter.class);
    RegExFilter.setRegexs(is, ".*2", null, null, null, false);
   
    assertTrue(rei.validateOptions(is.getOptions()));
    rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
    rei.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k3));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    is.clearOptions();
   
    RegExFilter.setRegexs(is, null, "ya.*", null, null, false);
    assertTrue(rei.validateOptions(is.getOptions()));
    rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
    rei.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    is.clearOptions();
   
    RegExFilter.setRegexs(is, null, null, ".*01", null, false);
    assertTrue(rei.validateOptions(is.getOptions()));
    rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
    rei.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k1));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    is.clearOptions();
   
    RegExFilter.setRegexs(is, null, null, null, ".*at", false);
    assertTrue(rei.validateOptions(is.getOptions()));
    rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
    rei.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    is.clearOptions();
   
    RegExFilter.setRegexs(is, null, null, null, ".*ap", false);
    rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
    rei.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    is.clearOptions();
   
    RegExFilter.setRegexs(is, null, "ya.*", null, ".*at", false);
    rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
    rei.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    is.clearOptions();
   
    RegExFilter.setRegexs(is, null, "ya.*", null, ".*ap", false);
    rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
    rei.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    is.clearOptions();
   
    RegExFilter.setRegexs(is, "boo1", null, null, null, false);
    rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
    rei.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k1));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    is.clearOptions();
   
    rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
    rei.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k1));
    rei.next();
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k3));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    is.clearOptions();
   
    RegExFilter.setRegexs(is, "hamster", null, "hamster", "hamster", true);
    rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
    rei.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k3));
    rei.next();
    assertFalse(rei.hasTop());
   
    // -----------------------------------------------------
    is.clearOptions();
   
    RegExFilter.setRegexs(is, null, "ya.*", "hamster", null, true);
    rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
    rei.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertTrue(rei.hasTop());
    assertTrue(rei.getTopKey().equals(k2));
    rei.next();
    assertFalse(rei.hasTop());
   
    is.clearOptions();
   
    RegExFilter.setRegexs(is, null, "ya.*", "hamster", null, true);
    rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
    rei.seek(new Range(), EMPTY_COL_FAMS, false);
    rei.deepCopy(new DefaultIteratorEnvironment());
   
    // -----------------------------------------------------
    String multiByteText = new String("\u6d67" + "\u6F68" + "\u7067");
    String multiByteRegex = new String(".*" + "\u6F68" + ".*");
   
    Key k4 = new Key("boo4".getBytes(), "hoo".getBytes(), "20080203".getBytes(), "".getBytes(), 1l);
    Value inVal = new Value(multiByteText.getBytes("UTF-8"));
    tm.put(k4, inVal);
   
    is.clearOptions();
   
    RegExFilter.setRegexs(is, null, null, null, multiByteRegex, true);
    rei.init(new SortedMapIterator(tm), is.getOptions(), new DefaultIteratorEnvironment());
    rei.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertTrue(rei.hasTop());
    Value outValue = rei.getTopValue();
    String outVal = new String(outValue.get(), "UTF-8");
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.iterators.DefaultIteratorEnvironment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.