Package org.apache.accumulo.core.data

Examples of org.apache.accumulo.core.data.Mutation$ByteBuffer


  public void testDelete() throws Exception {
    Connector c = new MockConnector("root", new MockInstance());
    c.tableOperations().create("test");
    BatchWriter bw = c.createBatchWriter("test", new BatchWriterConfig());
   
    Mutation m1 = new Mutation("r1");
   
    m1.put("cf1", "cq1", 1, "v1");
   
    bw.addMutation(m1);
    bw.flush();
   
    Mutation m2 = new Mutation("r1");
   
    m2.putDelete("cf1", "cq1", 2);
   
    bw.addMutation(m2);
    bw.flush();
   
    Scanner scanner = c.createScanner("test", Constants.NO_AUTHS);
View Full Code Here


    deleter.delete();
    this.checkRemaining(c, "test", 0);
   
    // test deleting just one row
    BatchWriter writer = c.createBatchWriter("test", new BatchWriterConfig());
    Mutation m = new Mutation("r1");
    m.put("fam", "qual", "value");
    writer.addMutation(m);
   
    // make sure the write goes through
    writer.flush();
    writer.close();
   
    deleter.setRanges(Collections.singletonList(new Range(("r1"))));
    deleter.delete();
    this.checkRemaining(c, "test", 0);
   
    // test multi row deletes
    writer = c.createBatchWriter("test", new BatchWriterConfig());
    m = new Mutation("r1");
    m.put("fam", "qual", "value");
    writer.addMutation(m);
    Mutation m2 = new Mutation("r2");
    m2.put("fam", "qual", "value");
    writer.addMutation(m2);
   
    // make sure the write goes through
    writer.flush();
    writer.close();
View Full Code Here

    Connector c = new MockConnector("root", new MockInstance());
    c.tableOperations().create("test");
    BatchWriter bw = c.createBatchWriter("test", new BatchWriterConfig());
   
    for (int i = 0; i < 10; i++) {
      Mutation m1 = new Mutation("r" + i);
      m1.put("cf1", "cq1", 1, "v" + i);
      bw.addMutation(m1);
    }
   
    bw.flush();
   
    int count = 10;
   
    Scanner scanner = c.createScanner("test", Constants.NO_AUTHS);
    for (Entry<Key,Value> entry : scanner) {
      Key key = entry.getKey();
      Mutation m = new Mutation(key.getRow());
      m.put(key.getColumnFamily().toString(), key.getColumnQualifier().toString(), key.getTimestamp() + 1, "v" + (count));
      count++;
      bw.addMutation(m);
    }
   
    bw.flush();
View Full Code Here

  public void testMockMultiTableBatchWriter() throws Exception {
    Connector c = new MockConnector("root", new MockInstance());
    c.tableOperations().create("a");
    c.tableOperations().create("b");
    MultiTableBatchWriter bw = c.createMultiTableBatchWriter(new BatchWriterConfig());
    Mutation m1 = new Mutation("r1");
    m1.put("cf1", "cq1", 1, "v1");
    BatchWriter b = bw.getBatchWriter("a");
    b.addMutation(m1);
    b.flush();
    b = bw.getBatchWriter("b");
    b.addMutation(m1);
View Full Code Here

    Connector c = new MockConnector("root", new MockInstance());
    c.tableOperations().create("test");
    BatchWriter bw = c.createBatchWriter("test", new BatchWriterConfig());
   
    for (int i = 0; i < 10; i++) {
      Mutation m = new Mutation("r1");
      m.put("cf1", "cq1", "" + i);
      bw.addMutation(m);
    }
   
    bw.close();
   
View Full Code Here

  static Key nk(int r, int c) {
    return new Key(new Text(FastFormat.toZeroPaddedString(r, 9, 10, ROW_PREFIX)), new Text(FastFormat.toZeroPaddedString(c, 6, 10, COL_PREFIX)));
  }
 
  static Mutation nm(int r) {
    return new Mutation(new Text(FastFormat.toZeroPaddedString(r, 9, 10, ROW_PREFIX)));
  }
View Full Code Here

    long tps = System.currentTimeMillis();
   
    if (nm != null) {
      for (int i = 0; i < numRows; i++) {
        int row = rand.nextInt(1000000000);
        Mutation m = nm(row);
        for (int j = 0; j < numCols; j++) {
          int col = rand.nextInt(1000000);
          Value val = new Value("test".getBytes(Constants.UTF8));
          pc(m, col, val);
        }
View Full Code Here

    try {
      Iterator<Entry<Key,Value>> iter = super.iterator();
      while (iter.hasNext()) {
        Entry<Key,Value> next = iter.next();
        Key k = next.getKey();
        Mutation m = new Mutation(k.getRow());
        m.putDelete(k.getColumnFamily(), k.getColumnQualifier(), new ColumnVisibility(k.getColumnVisibility()), k.getTimestamp());
        writer.addMutation(m);
      }
    } finally {
      writer.close();
    }
View Full Code Here

            for (Entry<KeyExtent,List<Mutation>> entry : tabMuts.entrySet()) {
              long size = 0;
              Iterator<Mutation> iter = entry.getValue().iterator();
              while (iter.hasNext()) {
                while (size < MUTATION_BATCH_SIZE && iter.hasNext()) {
                  Mutation mutation = iter.next();
                  updates.add(mutation.toThrift());
                  size += mutation.numBytes();
                }
               
                client.applyUpdates(tinfo, usid, entry.getKey().toThrift(), updates);
                updates.clear();
                size = 0;
View Full Code Here

          Key key = importIterator.getTopKey();
          Value value = importIterator.getTopValue();
          if (setTime) {
            key.setTimestamp(time);
          }
          Mutation mutation = new Mutation(key.getRow());
          if (!key.isDeleted()) {
            mutation.put(key.getColumnFamily(), key.getColumnQualifier(), new ColumnVisibility(key.getColumnVisibilityData().toArray()), key.getTimestamp(),
                value);
          } else {
            mutation.putDelete(key.getColumnFamily(), key.getColumnQualifier(), new ColumnVisibility(key.getColumnVisibilityData().toArray()),
                key.getTimestamp());
          }
          table.addMutation(mutation);
          importIterator.next();
        }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.data.Mutation$ByteBuffer

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.