Package org.apache.accumulo.core.data

Examples of org.apache.accumulo.core.data.Value


        iter.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
       
        while (iter.hasTop() && activeIters.size() > 0) {
          // RFile does not support MemKey, so we move the kv count into the value only for the RFile.
          // There is no need to change the MemKey to a normal key because the kvCount info gets lost when it is written
          Value newValue = new MemValue(iter.getTopValue(), ((MemKey) iter.getTopKey()).kvCount);
          out.append(iter.getTopKey(), newValue);
          iter.next();
        }
       
        out.close();
View Full Code Here


    Scanner scanner = opts.getConnector().createScanner("createEvents", opts.auths);
    scanner.setRange(range);

    Text row = new Text(opts.row);
    for (Entry<Key,Value> entry : scanner) {
      KeyExtent ke = new KeyExtent(entry.getKey().getRow(), new Value(TextUtil.getBytes(entry.getKey().getColumnFamily())));
      if (ke.contains(row)) {
        System.out.println(entry.getKey().getColumnQualifier() + " " + ke + " " + entry.getValue());
      }
    }
  }
View Full Code Here

    Connector c = mockInstance.getConnector("root", new PasswordToken(""));
    c.tableOperations().create(TEST_TABLE_1);
    BatchWriter bw = c.createBatchWriter(TEST_TABLE_1, new BatchWriterConfig());
    for (int i = 0; i < 100; i++) {
      Mutation m = new Mutation(new Text(String.format("%09x", i + 1)));
      m.put(new Text(), new Text(), new Value(String.format("%09x", i).getBytes()));
      bw.addMutation(m);
    }
    bw.close();
   
    MRTester.main(new String[] {"root", "", TEST_TABLE_1});
View Full Code Here

    public void mutate(List<Mutation> mutations, int kvCount) {
      for (Mutation m : mutations) {
        for (ColumnUpdate cvp : m.getUpdates()) {
          Key newKey = new MemKey(m.getRow(), cvp.getColumnFamily(), cvp.getColumnQualifier(), cvp.getColumnVisibility(), cvp.getTimestamp(), cvp.isDeleted(),
              false, kvCount++);
          Value value = new Value(cvp.getValue());
          put(newKey, value);
        }
      }
    }
View Full Code Here

     
      byte[] serMut = WritableUtils.toByteArray(m);
     
      if (prevRow != null) {
        Mutation createEvent = new Mutation(new Text(m.getRow()));
        createEvent.put(prevRow, new Text(String.format("%020d", timestamp)), new Value(metaTablet.toString().getBytes(Constants.UTF8)));
        context.write(CREATE_EVENTS_TABLE, createEvent);
      }
     
      Mutation tabletEvent = new Mutation(new Text(m.getRow()));
      tabletEvent.put(new Text(String.format("%020d", timestamp)), new Text("mut"), new Value(serMut));
      tabletEvent.put(new Text(String.format("%020d", timestamp)), new Text("mtab"), new Value(metaTablet.toString().getBytes(Constants.UTF8)));
      tabletEvent.put(new Text(String.format("%020d", timestamp)), new Text("log"), new Value(logFile.getBytes(Constants.UTF8)));
      context.write(TABLET_EVENTS_TABLE, tabletEvent);
    }
View Full Code Here

    BatchWriter bw = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
    for (String line : metadata) {
      String[] parts = line.split(" ");
      String[] columnParts = parts[1].split(":");
      Mutation m = new Mutation(parts[0]);
      m.put(new Text(columnParts[0]), new Text(columnParts[1]), new Value(parts[2].getBytes()));
      bw.addMutation(m);
    }
   
    for (String line : deletes) {
      Mutation m = new Mutation(line);
View Full Code Here

  final private AtomicReference<BatchWriter> writer;
  final private Connector connector;
  final String table;
 
  private static void put(Mutation m, String cf, String cq, byte[] bytes, int len) {
    m.put(new Text(cf), new Text(cq), new Value(bytes, 0, len));
  }
View Full Code Here

      String idString = Long.toHexString(s.traceId);
      String startString = Long.toHexString(s.start);
      Mutation spanMutation = new Mutation(new Text(idString));
      Mutation indexMutation = new Mutation(new Text("idx:" + s.svc + ":" + startString));
      long diff = s.stop - s.start;
      indexMutation.put(new Text(s.description), new Text(s.sender), new Value((idString + ":" + Long.toHexString(diff)).getBytes(Constants.UTF8)));
      ByteArrayTransport transport = new ByteArrayTransport();
      TCompactProtocol protocol = new TCompactProtocol(transport);
      s.write(protocol);
      String parentString = Long.toHexString(s.parentId);
      if (s.parentId == Span.ROOT_SPAN_ID)
View Full Code Here

    private ColumnSliceFilter columnSliceFilter = new ColumnSliceFilter();
    private IteratorSetting is;

    private static Key nkv(SortedMap<Key,Value> tm, String row, String cf, String cq, String val) {
        Key k = nk(row, cf, cq);
        tm.put(k, new Value(val.getBytes()));
        return k;
    }
View Full Code Here

    c.tableOperations().create("test");
    BatchWriter bw = c.createBatchWriter("test", new BatchWriterConfig());
    for (int i = 0; i < 100; i++) {
      int r = random.nextInt();
      Mutation m = new Mutation(asText(r));
      m.put(asText(random.nextInt()), asText(random.nextInt()), new Value(Integer.toHexString(r).getBytes()));
      bw.addMutation(m);
    }
    bw.close();
    BatchScanner s = c.createBatchScanner("test", Constants.NO_AUTHS, 2);
    s.setRanges(Collections.singletonList(new Range()));
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.data.Value

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.