Examples of AggregatorConfiguration


Examples of org.apache.accumulo.core.iterators.aggregation.conf.AggregatorConfiguration

            throw new BadArgumentException("column must be in the format cf[:cq]", fullCommand, fullCommand.indexOf(col));
          cf = new Text(tokIter.next());
          if (colToks.count() == 2)
            cq = new Text(tokIter.next());
         
          aggregators.add(new AggregatorConfiguration(cf, cq, className));
        }
      }
      if (cl.hasOption(createTableOptSplit.getOpt())) {
        String f = cl.getOptionValue(createTableOptSplit.getOpt());
       
View Full Code Here

Examples of org.apache.accumulo.core.iterators.aggregation.conf.AggregatorConfiguration

  @Test
  public void testAggregation() throws Exception {
    MockInstance mockInstance = new MockInstance();
    Connector c = mockInstance.getConnector("root", new byte[] {});
    List<AggregatorConfiguration> aggregators = new ArrayList<AggregatorConfiguration>();
    aggregators.add(new AggregatorConfiguration(new Text("day"), "org.apache.accumulo.core.iterators.aggregation.StringSummation"));
    c.tableOperations().create("perDayCounts");
    c.tableOperations().addAggregators("perDayCounts", aggregators);
    String keys[][] = { {"foo", "day", "20080101"}, {"foo", "day", "20080101"}, {"foo", "day", "20080103"}, {"bar", "day", "20080101"},
        {"bar", "day", "20080101"},};
    BatchWriter bw = c.createBatchWriter("perDayCounts", 1000L, 1000L, 1);
View Full Code Here

Examples of org.apache.accumulo.core.iterators.aggregation.conf.AggregatorConfiguration

            throw new BadArgumentException("column must be in the format cf[:cq]", fullCommand, fullCommand.indexOf(col));
          cf = new Text(tokIter.next());
          if (colToks.count() == 2)
            cq = new Text(tokIter.next());
         
          aggregators.add(new AggregatorConfiguration(cf, cq, className));
        }
      }
      if (cl.hasOption(createTableOptSplit.getOpt())) {
        String f = cl.getOptionValue(createTableOptSplit.getOpt());
       
View Full Code Here

Examples of org.apache.accumulo.core.iterators.aggregation.conf.AggregatorConfiguration

  @Test
  public void testAggregation() throws Exception {
    MockInstance mockInstance = new MockInstance();
    Connector c = mockInstance.getConnector("root", new byte[] {});
    List<AggregatorConfiguration> aggregators = new ArrayList<AggregatorConfiguration>();
    aggregators.add(new AggregatorConfiguration(new Text("day"), "org.apache.accumulo.core.iterators.aggregation.StringSummation"));
    c.tableOperations().create("perDayCounts");
    c.tableOperations().addAggregators("perDayCounts", aggregators);
    String keys[][] = { {"foo", "day", "20080101"}, {"foo", "day", "20080101"}, {"foo", "day", "20080103"}, {"bar", "day", "20080101"},
        {"bar", "day", "20080101"},};
    BatchWriter bw = c.createBatchWriter("perDayCounts", 1000L, 1000L, 1);
View Full Code Here

Examples of org.apache.accumulo.core.iterators.aggregation.conf.AggregatorConfiguration

    // Logger logger = Logger.getLogger(Constants.CORE_PACKAGE_NAME);
    // logger.setLevel(Level.TRACE);
   
    getConnector().tableOperations().create("tt");
    getConnector().tableOperations().addAggregators("tt",
        Collections.singletonList(new AggregatorConfiguration(new Text("acf"), BadAggregator.class.getName())));
   
    BatchWriter bw = getConnector().createBatchWriter("tt", 1000000, 60000l, 2);
   
    Mutation m = new Mutation(new Text("r1"));
    m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes()));
   
    bw.addMutation(m);
   
    bw.close();
   
    // try to scan table
    Scanner scanner = getConnector().createScanner("tt", Constants.NO_AUTHS);
   
    boolean caught = false;
    try {
      for (Entry<Key,Value> entry : scanner) {
        entry.getKey();
      }
    } catch (Exception e) {
      caught = true;
    }
   
    if (!caught)
      throw new Exception("Scan did not fail");
   
    // try to batch scan the table
    BatchScanner bs = getConnector().createBatchScanner("tt", Constants.NO_AUTHS, 2);
    bs.setRanges(Collections.singleton(new Range()));
   
    caught = false;
    try {
      for (Entry<Key,Value> entry : bs) {
        entry.getKey();
      }
    } catch (Exception e) {
      caught = true;
    }
    if (!caught)
      throw new Exception("batch scan did not fail");
   
    List<AggregatorConfiguration> aggConfig = new ArrayList<AggregatorConfiguration>();
    aggConfig.add(new AggregatorConfiguration(new Text("acf"), BadAggregator.class.getName()));
    Map<String,String> props = IteratorUtil.generateInitialTableProperties(aggConfig);
   
    // remove the bad agg so accumulo can shutdown
    for (Entry<String,String> e : props.entrySet()) {
      getConnector().tableOperations().removeProperty("tt", e.getKey());
View Full Code Here

Examples of org.apache.accumulo.core.iterators.aggregation.conf.AggregatorConfiguration

    runTest(new Text("colf1"));
  }
 
  private void runTest(Text colf) {
    String encodedCols;
    AggregatorConfiguration ac3 = new AggregatorConfiguration(colf, "com.foo.SuperAgg");
    encodedCols = ac3.encodeColumns();
    PerColumnIteratorConfig ac4 = PerColumnIteratorConfig.decodeColumns(encodedCols, "com.foo.SuperAgg");
   
    assertEquals(colf, ac4.getColumnFamily());
    assertNull(ac4.getColumnQualifier());
  }
View Full Code Here

Examples of org.apache.accumulo.core.iterators.aggregation.conf.AggregatorConfiguration

    assertEquals(colf, ac4.getColumnFamily());
    assertNull(ac4.getColumnQualifier());
  }
 
  private void runTest(Text colf, Text colq) {
    AggregatorConfiguration ac = new AggregatorConfiguration(colf, colq, "com.foo.SuperAgg");
    String encodedCols = ac.encodeColumns();
    PerColumnIteratorConfig ac2 = PerColumnIteratorConfig.decodeColumns(encodedCols, "com.foo.SuperAgg");
   
    assertEquals(colf, ac2.getColumnFamily());
    assertEquals(colq, ac2.getColumnQualifier());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.