Package org.apache.accumulo.core.client

Examples of org.apache.accumulo.core.client.IteratorSetting


     *          the number of versions to return
     */
    protected void setupMaxVersions(Scanner scanner, int maxVersions) {
      // Check to make sure its a legit value
      if (maxVersions >= 1) {
        IteratorSetting vers = new IteratorSetting(0, "vers", VersioningIterator.class);
        VersioningIterator.setMaxVersions(vers, maxVersions);
        scanner.addScanIterator(vers);
      }
    }
View Full Code Here


          log.info("Using local iterators");
          scanner = new ClientSideIteratorScanner(scanner);
        }
        setupMaxVersions(scanner, maxVersions);
        if (rowRegex != null || colfRegex != null || colqRegex != null || valueRegex != null) {
          IteratorSetting is = new IteratorSetting(50, RegExFilter.class);
          RegExFilter.setRegexs(is, rowRegex, colfRegex, colqRegex, valueRegex, false);
          scanner.addScanIterator(is);
        }
        setupIterators(scanner, iterators, options);
      } catch (Exception e) {
View Full Code Here

   
    conn.securityOperations().createUser("user1", "pass1".getBytes(), new Authorizations("A", "B"));
    conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.WRITE);
    conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.READ);
   
    IteratorSetting is = new IteratorSetting(10, SummingCombiner.class);
    SummingCombiner.setEncodingType(is, LongCombiner.Type.STRING);
    SummingCombiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("META", "COUNT")));
   
    conn.tableOperations().attachIterator("table1", is);
   
View Full Code Here

 
  @Test
  public void testAttachIterator() throws Exception {
    Tester t = new Tester();
    Map<String,String> empty = Collections.emptyMap();
    t.attachIterator("table", new IteratorSetting(10, "someName", "foo.bar", empty), EnumSet.of(IteratorScope.scan));
    t.check("table", new String[] {"table.iterator.scan.someName=10,foo.bar",});
    t.removeIterator("table", "someName", EnumSet.of(IteratorScope.scan));
    t.check("table", new String[] {});
   
    IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
    setting.addOptions(Collections.singletonMap("key", "value"));
    t.attachIterator("table", setting, EnumSet.of(IteratorScope.majc));
    setting = new IteratorSetting(10, "someName", "foo.bar");
    t.attachIterator("table", setting, EnumSet.of(IteratorScope.scan));
    t.check("table", new String[] {"table.iterator.majc.someName=10,foo.bar", "table.iterator.majc.someName.opt.key=value",
        "table.iterator.scan.someName=10,foo.bar",});
   
    t.removeIterator("table", "someName", EnumSet.of(IteratorScope.scan));
    setting = new IteratorSetting(20, "otherName", "some.classname");
    setting.addOptions(Collections.singletonMap("key", "value"));
    t.attachIterator("table", setting, EnumSet.of(IteratorScope.majc));
    setting = new IteratorSetting(20, "otherName", "some.classname");
    t.attachIterator("table", setting, EnumSet.of(IteratorScope.scan));
    Map<String,EnumSet<IteratorScope>> two = t.listIterators("table");
    Assert.assertEquals(2, two.size());
    Assert.assertTrue(two.containsKey("otherName"));
    Assert.assertTrue(two.get("otherName").size() == 2);
    Assert.assertTrue(two.get("otherName").contains(IteratorScope.majc));
    Assert.assertTrue(two.get("otherName").contains(IteratorScope.scan));
    Assert.assertTrue(two.containsKey("someName"));
    Assert.assertTrue(two.get("someName").size() == 1);
    Assert.assertTrue(two.get("someName").contains(IteratorScope.majc));
    t.removeIterator("table", "someName", EnumSet.allOf(IteratorScope.class));
    t.check("table", new String[] {"table.iterator.majc.otherName=20,some.classname", "table.iterator.majc.otherName.opt.key=value",
        "table.iterator.scan.otherName=20,some.classname",});
   
    setting = t.getIteratorSetting("table", "otherName", IteratorScope.scan);
    Assert.assertEquals(20, setting.getPriority());
    Assert.assertEquals("some.classname", setting.getIteratorClass());
    Assert.assertTrue(setting.getOptions().isEmpty());
    setting = t.getIteratorSetting("table", "otherName", IteratorScope.majc);
    Assert.assertEquals(20, setting.getPriority());
    Assert.assertEquals("some.classname", setting.getIteratorClass());
    Assert.assertFalse(setting.getOptions().isEmpty());
    Assert.assertEquals(Collections.singletonMap("key", "value"), setting.getOptions());
    t.attachIterator("table", setting, EnumSet.of(IteratorScope.minc));
    t.check("table", new String[] {"table.iterator.majc.otherName=20,some.classname", "table.iterator.majc.otherName.opt.key=value",
        "table.iterator.minc.otherName=20,some.classname", "table.iterator.minc.otherName.opt.key=value", "table.iterator.scan.otherName=20,some.classname",});
   
    try {
      t.attachIterator("table", setting);
      Assert.fail();
    } catch (IllegalArgumentException e) {}
    setting.setName("thirdName");
    try {
      t.attachIterator("table", setting);
      Assert.fail();
    } catch (IllegalArgumentException e) {}
    setting.setPriority(10);
    t.setProperty("table", "table.iterator.minc.thirdName.opt.key", "value");
    try {
      t.attachIterator("table", setting);
      Assert.fail();
    } catch (IllegalArgumentException e) {}
View Full Code Here

   
    System.out.println("Reading: ");
   
    String regex = "cf1.*";
   
    IteratorSetting is = new IteratorSetting(50, regex, RegExFilter.class);
    RegExFilter.setRegexs(is, null, regex, null, null, false);
   
    String cookie = tpc.proxy().createScanner(login, testTable, null);
   
    int i = 0;
View Full Code Here

    int count = 0;
    Scanner scanner;
   
    ScanTask(Connector conn, long time) throws Exception {
      scanner = conn.createScanner("cct", Constants.NO_AUTHS);
      IteratorSetting slow = new IteratorSetting(30, "slow", SlowIterator.class);
      slow.addOption("sleepTime", "" + time);
      scanner.addScanIterator(slow);
    }
View Full Code Here

    List<IteratorSetting> list = new ArrayList<IteratorSetting>();
    try {
      while (tokens.hasMoreTokens()) {
        String itstring = tokens.nextToken();
        ByteArrayInputStream bais = new ByteArrayInputStream(Base64.decodeBase64(itstring.getBytes()));
        list.add(new IteratorSetting(new DataInputStream(bais)));
        bais.close();
      }
    } catch (IOException e) {
      throw new IllegalArgumentException("couldn't decode iterator settings");
    }
View Full Code Here

      throw new Exception("Ended at " + expected + " not " + (finish + 2));
    }
  }
 
  private void setupIter(ScannerBase scanner) throws Exception {
    IteratorSetting dropMod = new IteratorSetting(50, "dropMod", "org.apache.accumulo.test.functional.DropModIter");
    dropMod.addOption("mod", "2");
    dropMod.addOption("drop", "0");
    scanner.addScanIterator(dropMod);
  }
View Full Code Here

    // handle first argument, if present, the authorizations list to
    // scan with
    final Authorizations auths = getAuths(cl, shellState);
    final Scanner scanner = shellState.getConnector().createScanner(tableName, auths);
   
    scanner.addScanIterator(new IteratorSetting(Integer.MAX_VALUE, "NOVALUE", SortedKeyIterator.class));
   
    // handle session-specific scan iterators
    addScanIterators(shellState, cl, scanner, tableName);
   
    // handle remaining optional arguments
View Full Code Here

    // should not timeout
    for (Entry<Key,Value> entry : bs) {
      entry.getKey();
    }
   
    IteratorSetting iterSetting = new IteratorSetting(100, SlowIterator.class);
    iterSetting.addOption("sleepTime", 2000 + "");
    getConnector().tableOperations().attachIterator("timeout", iterSetting);
    UtilWaitThread.sleep(250);

    try {
      for (Entry<Key,Value> entry : bs) {
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.client.IteratorSetting

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.