Package org.apache.accumulo.core.data

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


        iter.seek(new Range(key.followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive()), columnFamilies, inclusive);
      }
    }

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

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


      throw new IllegalArgumentException("Cannot seek to null range");
   
    if (interruptFlag != null && interruptFlag.get())
      throw new IterationInterruptedException();
   
    Key key = range.getStartKey();
    if (key == null) {
      key = new Key();
    }
   
    reader.seek(key);
   
    while (hasTop() && range.beforeStartKey(getTopKey())) {
View Full Code Here

  protected Key buildKey(Text partition, Text term, Text docID) {
    Text colq = new Text(term);
    colq.append(nullByte, 0, 1);
    colq.append(docID.getBytes(), 0, docID.getLength());
    colq.append(nullByte, 0, 1);
    return new Key(partition, indexColf, colq);
  }
View Full Code Here

  }
 
  @Override
  protected Key buildKey(Text partition, Text term) {
    Text colq = new Text(term);
    return new Key(partition, indexColf, colq);
  }
View Full Code Here

    super.advanceToIntersection();
    if (topKey == null)
      return;
    if (log.isTraceEnabled())
      log.trace("using top key to seek for doc: " + topKey.toString());
    Key docKey = buildDocKey();
    docSource.seek(new Range(docKey, true, null, false), docColfSet, true);
    log.debug("got doc key: " + docSource.getTopKey().toString());
    if (docSource.hasTop() && docKey.equals(docSource.getTopKey(), PartialKey.ROW_COLFAM_COLQUAL)) {
      value = docSource.getTopValue();
    }
    log.debug("got doc value: " + value.toString());
  }
View Full Code Here

    docColfSet = Collections.singleton((ByteSequence) new ArrayByteSequence(colf.getBytes(), 0, colf.getLength()));
    if (log.isTraceEnabled())
      log.trace(zeroIndex + " " + currentDocID.getLength());
    Text colq = new Text();
    colq.set(currentDocID.getBytes(), zeroIndex + 1, currentDocID.getLength() - zeroIndex - 1);
    Key k = new Key(currentPartition, colf, colq);
    if (log.isTraceEnabled())
      log.trace("built doc key for seek: " + k.toString());
    return k;
  }
View Full Code Here

        continue;
      }
     
      tabletLocations.add(tl);
     
      while (tl.tablet_extent.getEndRow() != null && !range.afterEndKey(new Key(tl.tablet_extent.getEndRow()).followingKey(PartialKey.ROW))) {
        if (useCache) {
          Text row = new Text(tl.tablet_extent.getEndRow());
          row.append(new byte[] {0}, 0, 1);
          tl = locateTabletInCache(row);
        } else {
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

  public static final Value encodeRow(List<Key> keys, List<Value> values) throws IOException {
    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);
    }
View Full Code Here

        return;
      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);
    topValue = encodeRow(keys, values);
   
  }
View Full Code Here

TOP

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

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.