Package org.apache.accumulo.core.data

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


        if (timeType.equals(TimeType.LOGICAL))
          key.setTimestamp(mutationCount);
        else
          key.setTimestamp(now);
     
      table.put(new MockMemKey(key, mutationCount), new Value(u.getValue()));
    }
  }
View Full Code Here


      }
    }

    if (iter.hasTop()) {
      Key nextKey = iter.getTopKey();
      Value nextVal = iter.getTopValue();

      try {
        key = (Key) nextKey.clone();
      } catch (CloneNotSupportedException e) {
        throw new IOException(e);
View Full Code Here

    assertFalse(client.tableExists(creds, "test"));
    // bulk import
    String filename = dir + "/bulk/import/rfile.rf";
    FileSKVWriter writer = FileOperations.getInstance().openWriter(filename, fs, fs.getConf(), DefaultConfiguration.getInstance());
    writer.startDefaultLocalityGroup();
    writer.append(new org.apache.accumulo.core.data.Key(new Text("a"), new Text("b"), new Text("c")), new Value("value".getBytes()));
    writer.close();
    fs.mkdirs(new Path(dir + "/bulk/fail"));
    client.importDirectory(creds, "bar", dir + "/bulk/import", dir + "/bulk/fail", true);
    scanner = client.createScanner(creds, "bar", null);
    more = client.nextK(scanner, 100);
View Full Code Here

      byte[] cf = readField(din); // read the col fam
      byte[] cq = readField(din); // read the col qual
      byte[] cv = readField(din); // read the col visibility
      long timestamp = din.readLong(); // read the timestamp
      byte[] valBytes = readField(din); // read the value
      map.put(new Key(rowKey.getRowData().toArray(), cf, cq, cv, timestamp, false, false), new Value(valBytes, false));
    }
    return map;
  }
View Full Code Here

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    DataOutputStream dout = new DataOutputStream(out);
    dout.writeInt(keys.size());
    for (int i = 0; i < keys.size(); i++) {
      Key k = keys.get(i);
      Value v = values.get(i);
      // write the colfam
      {
        ByteSequence bs = k.getColumnFamilyData();
        dout.writeInt(bs.length());
        dout.write(bs.getBackingArray(), bs.offset(), bs.length());
      }
      // write the colqual
      {
        ByteSequence bs = k.getColumnQualifierData();
        dout.writeInt(bs.length());
        dout.write(bs.getBackingArray(), bs.offset(), bs.length());
      }
      // write the column visibility
      {
        ByteSequence bs = k.getColumnVisibilityData();
        dout.writeInt(bs.length());
        dout.write(bs.getBackingArray(), bs.offset(), bs.length());
      }
      // write the timestamp
      dout.writeLong(k.getTimestamp());
      // write the value
      byte[] valBytes = v.get();
      dout.writeInt(valBytes.length);
      dout.write(valBytes);
    }
   
    return new Value(out.toByteArray());
  }
View Full Code Here

      currentRow = new Text(sourceIter.getTopKey().getRow());
      keys.clear();
      values.clear();
      while (sourceIter.hasTop() && sourceIter.getTopKey().getRow().equals(currentRow)) {
        keys.add(new Key(sourceIter.getTopKey()));
        values.add(new Value(sourceIter.getTopValue()));
        sourceIter.next();
      }
    } while (!filter(currentRow, keys, values));
   
    topKey = new Key(currentRow);
View Full Code Here

        opTimer.stop("Got 1st multi scan results, #results=" + scanResult.results.size() + (scanResult.more ? "  scanID=" + imsr.scanID : "")
            + " in %DURATION%");
       
        ArrayList<Entry<Key,Value>> entries = new ArrayList<Map.Entry<Key,Value>>(scanResult.results.size());
        for (TKeyValue kv : scanResult.results) {
          entries.add(new MyEntry(new Key(kv.key), new Value(kv.value)));
        }
       
        if (entries.size() > 0)
          receiver.receive(entries);
       
        if (entries.size() > 0 || scanResult.fullScans.size() > 0)
          timeoutTracker.madeProgress();
       
        trackScanning(failures, unscanned, scanResult);
       
        while (scanResult.more) {
         
          timeoutTracker.check();
         
          opTimer.start("Continuing multi scan, scanid=" + imsr.scanID);
          scanResult = client.continueMultiScan(Tracer.traceInfo(), imsr.scanID);
          opTimer.stop("Got more multi scan results, #results=" + scanResult.results.size() + (scanResult.more ? "  scanID=" + imsr.scanID : "")
              + " in %DURATION%");
         
          entries = new ArrayList<Map.Entry<Key,Value>>(scanResult.results.size());
          for (TKeyValue kv : scanResult.results) {
            entries.add(new MyEntry(new Key(kv.key), new Value(kv.value)));
          }
         
          if (entries.size() > 0)
            receiver.receive(entries);
         
View Full Code Here

 
  private synchronized void buildIndex(int indexEntries, ABlockReader cacheBlock, IndexEntry indexEntry) throws IOException {
    cacheBlock.seek(0);
   
    RelativeKey rk = new RelativeKey();
    Value val = new Value();
   
    int interval = indexEntry.getNumEntries() / indexEntries;
   
    if (interval <= 32)
      return;
   
    // multiple threads could try to create the index with different sizes, do not replace a large index with a smaller one
    if (this.blockIndex != null && this.blockIndex.length > indexEntries - 1)
      return;

    int count = 0;
   
    ArrayList<BlockIndexEntry> index = new ArrayList<BlockIndexEntry>(indexEntries - 1);

    while (count < (indexEntry.getNumEntries() - interval + 1)) {

      Key myPrevKey = rk.getKey();
      int pos = cacheBlock.getPosition();
      rk.readFields(cacheBlock);
      val.readFields(cacheBlock);

      if (count > 0 && count % interval == 0) {
        index.add(new BlockIndexEntry(pos, indexEntry.getNumEntries() - count, myPrevKey));
      }
     
View Full Code Here

     
      if (opts.histogram || opts.dump) {
        iter.seek(new Range((Key) null, (Key) null), new ArrayList<ByteSequence>(), false);
        while (iter.hasTop()) {
          Key key = iter.getTopKey();
          Value value = iter.getTopValue();
          if (opts.dump)
            System.out.println(key + " -> " + value);
          if (opts.histogram) {
            long size = key.getSize() + value.getSize();
            int bucket = (int) Math.log10(size);
            countBuckets[bucket]++;
            sizeBuckets[bucket] += size;
            totalSize += size;
          }
View Full Code Here

  private void addKeyValue(Key k, Value v) {
    if (dropEmptyColFams && k.getColumnFamilyData().equals(EMPTY)) {
      return;
    }
    keys.add(new Key(k));
    values.add(new Value(v));
  }
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.