Package org.apache.accumulo.core.data

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


        } else {
          rowid = i;
        }
       
        Text row = generateRow(rowid, opts.startRow);
        Mutation m = new Mutation(row);
        for (int j = 0; j < opts.cols; j++) {
          Text colf = new Text(opts.columnFamily);
          Text colq = new Text(FastFormat.toZeroPaddedString(j, 7, 10, COL_PREFIX));
         
          if (writer != null) {
            Key key = new Key(row, colf, colq, labBA);
            if (opts.timestamp >= 0) {
              key.setTimestamp(opts.timestamp);
            } else {
              key.setTimestamp(startTime);
            }
           
            if (opts.delete) {
              key.setDeleted(true);
            } else {
              key.setDeleted(false);
            }
           
            bytesWritten += key.getSize();
           
            if (opts.delete) {
              writer.append(key, new Value(new byte[0]));
            } else {
              byte value[];
              if (opts.random != null) {
                value = genRandomValue(random, randomValue, opts.random.intValue(), rowid + opts.startRow, j);
              } else {
                value = bytevals[j % bytevals.length];
              }
             
              Value v = new Value(value);
              writer.append(key, v);
              bytesWritten += v.getSize();
            }
           
          } else {
            Key key = new Key(row, colf, colq, labBA);
            bytesWritten += key.getSize();
           
            if (opts.delete) {
              if (opts.timestamp >= 0)
                m.putDelete(colf, colq, opts.columnVisibility, opts.timestamp);
              else
                m.putDelete(colf, colq, opts.columnVisibility);
            } else {
              byte value[];
              if (opts.random != null) {
                value = genRandomValue(random, randomValue, opts.random.intValue(), rowid + opts.startRow, j);
              } else {
                value = bytevals[j % bytevals.length];
              }
              bytesWritten += value.length;
             
              if (opts.timestamp >= 0) {
                m.put(colf, colq, opts.columnVisibility, opts.timestamp, new Value(value, true));
              } else {
                m.put(colf, colq, opts.columnVisibility, new Value(value, true));
               
              }
            }
          }
         
View Full Code Here


      exception = null;
    }
  }
 
  void removeFromMetadataTable() throws Exception {
    Mutation m = new Mutation(new Text("~err_" + tableName));
    m.putDelete(new Text(problemType.name()), new Text(resource));
    MetadataTable.getMetadataTable(SecurityConstants.getSystemCredentials()).update(m);
  }
View Full Code Here

    m.putDelete(new Text(problemType.name()), new Text(resource));
    MetadataTable.getMetadataTable(SecurityConstants.getSystemCredentials()).update(m);
  }
 
  void saveToMetadataTable() throws Exception {
    Mutation m = new Mutation(new Text("~err_" + tableName));
    m.put(new Text(problemType.name()), new Text(resource), new Value(encode()));
    MetadataTable.getMetadataTable(SecurityConstants.getSystemCredentials()).update(m);
  }
View Full Code Here

    testLotsOfOverwrites();
    testLotsOfGetsAndScans();
  }
 
  private static void put(NativeMap nm, String row, String val, int mc) {
    Mutation m = new Mutation(new Text(row));
    m.put(new Text(), new Text(), Long.MAX_VALUE, new Value(val.getBytes(Constants.UTF8)));
    nm.mutate(m, mc);
  }
View Full Code Here

   
    BatchWriter bw = uconn.createBatchWriter("table1", new BatchWriterConfig());
   
    UUID uuid = UUID.randomUUID();
   
    Mutation m = new Mutation(uuid.toString());
    m.put("META", "SIZE", new ColumnVisibility("A|B"), "8");
    m.put("META", "CRC", new ColumnVisibility("A|B"), "456");
    m.put("META", "COUNT", new ColumnVisibility("A|B"), "1");
    m.put("DATA", "IMG", new ColumnVisibility("A&B"), "ABCDEFGH");
   
    bw.addMutation(m);
    bw.flush();
   
    m = new Mutation(uuid.toString());
    m.put("META", "COUNT", new ColumnVisibility("A|B"), "1");
    m.put("META", "CRC", new ColumnVisibility("A|B"), "123");
    bw.addMutation(m);
   
    bw.close();
   
    int count = 0;
View Full Code Here

    conn.tableOperations().setProperty("table2", Property.TABLE_CLASSPATH.getKey(), "cx1");
    conn.tableOperations().attachIterator("table2", new IteratorSetting(100, "foocensor", "org.apache.accumulo.test.FooFilter"));
   
    BatchWriter bw = conn.createBatchWriter("table2", new BatchWriterConfig());
   
    Mutation m1 = new Mutation("foo");
    m1.put("cf1", "cq1", "v2");
    m1.put("cf1", "cq2", "v3");
   
    bw.addMutation(m1);
   
    Mutation m2 = new Mutation("bar");
    m2.put("cf1", "cq1", "v6");
    m2.put("cf1", "cq2", "v7");
   
    bw.addMutation(m2);
   
    bw.close();
   
View Full Code Here

    BatchWriter bw = null;
   
    // Add some data
    try {
      bw = c.createBatchWriter(table, new BatchWriterConfig());
      Mutation m = new Mutation("a");
      for (int i = 0; i < 50; i++) {
        m.put("colf", Integer.toString(i), "");
      }
     
      bw.addMutation(m);
    } finally {
      if (null != bw) {
View Full Code Here

    Logger.getLogger(ZooConfiguration.class).setLevel(Level.OFF);
    Logger.getLogger(HdfsZooInstance.class).setLevel(Level.OFF);
  }
 
  public void mutate(InMemoryMap imm, String row, String column, long ts) {
    Mutation m = new Mutation(new Text(row));
    String[] sa = column.split(":");
    m.putDelete(new Text(sa[0]), new Text(sa[1]), ts);
   
    imm.mutate(Collections.singletonList(m));
  }
View Full Code Here

   
    imm.mutate(Collections.singletonList(m));
  }
 
  public void mutate(InMemoryMap imm, String row, String column, long ts, String value) {
    Mutation m = new Mutation(new Text(row));
    String[] sa = column.split(":");
    m.put(new Text(sa[0]), new Text(sa[1]), ts, new Value(value.getBytes()));
   
    imm.mutate(Collections.singletonList(m));
  }
View Full Code Here

  }
 
  public void testDuplicateKey() throws Exception {
    InMemoryMap imm = new InMemoryMap(false, System.getProperty("user.dir") + "/target");
   
    Mutation m = new Mutation(new Text("r1"));
    m.put(new Text("foo"), new Text("cq"), 3, new Value("v1".getBytes()));
    m.put(new Text("foo"), new Text("cq"), 3, new Value("v2".getBytes()));
    imm.mutate(Collections.singletonList(m));
   
    MemoryIterator skvi1 = imm.skvIterator();
    skvi1.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
    ae(skvi1, "r1", "foo:cq", 3, "v2");
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.