Package org.apache.accumulo.core.data

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


      Assert.fail("addMutation should throw IAE for empty mutation");
    } catch (IllegalArgumentException iae) {}


    Mutation good = new Mutation("good");
    good.put(asText(random.nextInt()), asText(random.nextInt()), new Value("good".getBytes()));
    List<Mutation> mutations = new ArrayList<Mutation>();
    mutations.add(good);
    mutations.add(bad);
    try {
      bw.addMutations(mutations);
View Full Code Here


      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);
        }
        nm.mutate(m, i);
      }
    } else {
      for (int i = 0; i < numRows; i++) {
        int row = rand.nextInt(1000000000);
        for (int j = 0; j < numCols; j++) {
          int col = rand.nextInt(1000000);
          Key key = nk(row, col);
          Value val = new Value("test".getBytes(Constants.UTF8));
          tm.put(key, val);
        }
      }
    }
   
View Full Code Here

    String keys[][] = { {"foo", "day", "20080101"}, {"foo", "day", "20080101"}, {"foo", "day", "20080103"}, {"bar", "day", "20080101"},
        {"bar", "day", "20080101"},};
    BatchWriter bw = c.createBatchWriter("perDayCounts", new BatchWriterConfig());
    for (String elt[] : keys) {
      Mutation m = new Mutation(new Text(elt[0]));
      m.put(new Text(elt[1]), new Text(elt[2]), new Value("1".getBytes()));
      bw.addMutation(m);
    }
    bw.close();
   
    Scanner s = c.createScanner("perDayCounts", Constants.NO_AUTHS);
View Full Code Here

    return newInstance;
  }
 
  @Override
  public Value reduce(Key key, Iterator<Value> iter) {
    return new Value(encoder.encode(typedReduce(key, new VIterator<V>(iter, encoder, lossy))));
  }
View Full Code Here

        count++;
        source.next();
      }
     
      this.key = new Key(currentRow.toArray(), currentColf.toArray(), new byte[0], new byte[0], ts);
      this.value = new Value(Integer.toString(count).getBytes(Constants.UTF8));
     
    } else {
      this.key = null;
      this.value = null;
    }
View Full Code Here

     */
    @Override
    public Value next() {
      if (!hasNext)
        throw new NoSuchElementException();
      Value topValue = new Value(source.getTopValue());
      try {
        source.next();
        hasNext = _hasNext();
      } catch (IOException e) {
        throw new RuntimeException(e);
View Full Code Here

    }
  }
 
  public static Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>> getMetadataLocationEntries(SortedMap<Key,Value> entries) {
    Key key;
    Value val;
    Text location = null;
    Value prevRow = null;
    KeyExtent ke;
   
    SortedMap<KeyExtent,Text> results = new TreeMap<KeyExtent,Text>();
    ArrayList<KeyExtent> locationless = new ArrayList<KeyExtent>();
   
    Text lastRowFromKey = new Text();
   
    // text obj below is meant to be reused in loop for efficiency
    Text colf = new Text();
    Text colq = new Text();
   
    for (Entry<Key,Value> entry : entries.entrySet()) {
      key = entry.getKey();
      val = entry.getValue();
     
      if (key.compareRow(lastRowFromKey) != 0) {
        prevRow = null;
        location = null;
        key.getRow(lastRowFromKey);
      }
     
      colf = key.getColumnFamily(colf);
      colq = key.getColumnQualifier(colq);
     
      // interpret the row id as a key extent
      if (colf.equals(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY) || colf.equals(Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY)) {
        if (location != null) {
          throw new IllegalStateException("Tablet has multiple locations : " + lastRowFromKey);
        }
        location = new Text(val.toString());
      } else if (Constants.METADATA_PREV_ROW_COLUMN.equals(colf, colq)) {
        prevRow = new Value(val);
      }
     
      if (prevRow != null) {
        ke = new KeyExtent(key.getRow(), prevRow);
        if (location != null)
View Full Code Here

      try {
        FileSKVIterator importIterator = FileOperations.getInstance().openReader(importStatus.getPath().toString(), true, fs, fs.getConf(),
            AccumuloConfiguration.getDefaultConfiguration());
        while (importIterator.hasTop()) {
          Key key = importIterator.getTopKey();
          Value value = importIterator.getTopValue();
          if (setTime) {
            key.setTimestamp(time);
          }
          Mutation mutation = new Mutation(key.getRow());
          if (!key.isDeleted()) {
View Full Code Here

          value = update.getValue();
        if (update.isSetTimestamp()) {
          if (update.isSetDeleteCell()) {
            m.putDelete(update.getColFamily(), update.getColQualifier(), viz, update.getTimestamp());
          } else {
            m.put(new Text(update.getColFamily()), new Text(update.getColQualifier()), viz, update.getTimestamp(), new Value(value));
            }
        } else {
          if (update.isSetDeleteCell()) {
            m.putDelete(new Text(update.getColFamily()), new Text(update.getColQualifier()), viz);
          } else {
            m.put(new Text(update.getColFamily()), new Text(update.getColQualifier()), viz, new Value(value));
          }
        }
      }
      try {
        bwpe.writer.addMutation(m);
View Full Code Here

   
    bmfw.startDefaultLocalityGroup();
   
    for (Integer i : vals) {
      String fi = String.format("%010d", i);
      bmfw.append(new org.apache.accumulo.core.data.Key(new Text("r" + fi), new Text("cf1")), new Value(("v" + fi).getBytes(Constants.UTF8)));
      bmfw.append(new org.apache.accumulo.core.data.Key(new Text("r" + fi), new Text("cf2")), new Value(("v" + fi).getBytes(Constants.UTF8)));
    }
   
    long t2 = System.currentTimeMillis();
   
    out.printf("write rate %6.2f%n", vals.size() / ((t2 - t1) / 1000.0));
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.