Package org.apache.accumulo.core.data

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


   
    String ecf = LocalityGroupUtil.encodeColumnFamily(bs1);
   
    // System.out.println(ecf);
   
    ByteSequence bs2 = LocalityGroupUtil.decodeColumnFamily(ecf);
   
    Assert.assertEquals(bs1, bs2);
    Assert.assertEquals(ecf, LocalityGroupUtil.encodeColumnFamily(bs2));
   
    // test encoding multiple column fams containing binary data
View Full Code Here


 
  public static Set<ByteSequence> decodeColumnFamilies(String colFams) throws LocalityGroupConfigurationError {
    HashSet<ByteSequence> colFamsSet = new HashSet<ByteSequence>();
   
    for (String family : colFams.split(",")) {
      ByteSequence cfbs = decodeColumnFamily(family);
      colFamsSet.add(cfbs);
    }
   
    return colFamsSet;
  }
View Full Code Here

       
        consumeRow(source.getTopKey().getRowData());
       
      } else {
       
        ByteSequence currentRow = keys.get(0).getRowData();
        source.next();
       
        while (source.hasTop() && source.getTopKey().getRowData().equals(currentRow)) {
         
          addKeyValue(source.getTopKey(), source.getTopValue());
         
          if (keys.size() > maxColumns) {
            keys.clear();
            values.clear();
           
            // when the row is to big, just emit a suppression
            // marker
            addKeyValue(new Key(new Text(currentRow.toArray())), SUPPRESS_ROW_VALUE);
            consumeRow(currentRow);
          } else {
            source.next();
          }
        }
View Full Code Here

    // this method mostly avoids object allocation and only does compares when the row changes
   
    MByteSequence row, cf, cq, cv;
    MByteSequence prow, pcf, pcq, pcv;
   
    ByteSequence stopRow = seekKey.getRowData();
    ByteSequence stopCF = seekKey.getColumnFamilyData();
    ByteSequence stopCQ = seekKey.getColumnQualifierData();
   
    long ts = -1;
    long pts = -1;
    boolean pdel = false;
   
View Full Code Here

  }
 
  @Override
  public void next() throws IOException {
    if (source.hasTop()) {
      ByteSequence currentRow = source.getTopKey().getRowData();
      ByteSequence currentColf = source.getTopKey().getColumnFamilyData();
      long ts = source.getTopKey().getTimestamp();
     
      source.next();
     
      int count = 1;
     
      while (source.hasTop() && source.getTopKey().getRowData().equals(currentRow) && source.getTopKey().getColumnFamilyData().equals(currentColf)) {
        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());
     
    } else {
      this.key = null;
      this.value = null;
View Full Code Here

    private int timeOut;
    private int batchSize;
   
    private void readRow() {
     
      ByteSequence row = null;
     
      while (true) {
        buffer.clear();
       
        try {
View Full Code Here

    public void updateColumnCount(Key key) {
     
      if (isDefaultLG && columnFamilies == null) {
        if (previousColumnFamilies.size() > 0) {
          // only do this check when there are previous column families
          ByteSequence cf = key.getColumnFamilyData();
          if (previousColumnFamilies.contains(cf)) {
            throw new IllegalArgumentException("Added column family \"" + cf + "\" to default locality group that was in previous locality group");
          }
        }
       
        // no longer keeping track of column families, so return
        return;
      }
     
      ByteSequence cf = key.getColumnFamilyData();
      Count count = columnFamilies.get(cf);
     
      if (count == null) {
        if (!isDefaultLG) {
          throw new IllegalArgumentException("invalid column family : " + cf);
        }
       
        if (previousColumnFamilies.contains(cf)) {
          throw new IllegalArgumentException("Added column family \"" + cf + "\" to default locality group that was in previous locality group");
        }
       
        if (columnFamilies.size() > Writer.MAX_CF_IN_DLG) {
          // stop keeping track, there are too many
          columnFamilies = null;
          return;
        }
        count = new Count(0);
        columnFamilies.put(new ArrayByteSequence(cf.getBackingArray(), cf.offset(), cf.length()), count);
       
      }
     
      count.count++;
     
View Full Code Here

  @Override
  public org.apache.hadoop.util.bloom.Key transform(org.apache.accumulo.core.data.Key acuKey) {
   
    byte keyData[];
   
    ByteSequence row = acuKey.getRowData();
    ByteSequence cf = acuKey.getColumnFamilyData();
    keyData = new byte[row.length() + cf.length()];
    System.arraycopy(row.getBackingArray(), row.offset(), keyData, 0, row.length());
    System.arraycopy(cf.getBackingArray(), cf.offset(), keyData, row.length(), cf.length());
   
    return new org.apache.hadoop.util.bloom.Key(keyData, 1.0);
  }
View Full Code Here

 
  @Override
  public org.apache.hadoop.util.bloom.Key transform(org.apache.accumulo.core.data.Key acuKey) {
    byte keyData[];
   
    ByteSequence row = acuKey.getRowData();
    ByteSequence cf = acuKey.getColumnFamilyData();
    ByteSequence cq = acuKey.getColumnQualifierData();
    keyData = new byte[row.length() + cf.length() + cq.length()];
    System.arraycopy(row.getBackingArray(), row.offset(), keyData, 0, row.length());
    System.arraycopy(cf.getBackingArray(), cf.offset(), keyData, row.length(), cf.length());
    System.arraycopy(cq.getBackingArray(), cq.offset(), keyData, row.length() + cf.length(), cq.length());
   
    return new org.apache.hadoop.util.bloom.Key(keyData, 1.0);
  }
View Full Code Here

 
  @Override
  public org.apache.hadoop.util.bloom.Key transform(org.apache.accumulo.core.data.Key acuKey) {
    byte keyData[];
   
    ByteSequence row = acuKey.getRowData();
    keyData = new byte[row.length()];
    System.arraycopy(row.getBackingArray(), 0, keyData, 0, row.length());
   
    return new org.apache.hadoop.util.bloom.Key(keyData, 1.0);
  }
View Full Code Here

TOP

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

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.