Package org.apache.accumulo.core.data

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


   
  }
 
  public IterConfig decompress(ByteBuffer iterators) {
   
    ByteSequence iterKey = new ArrayByteSequence(iterators);
    IterConfig config = cache.get(iterKey);
    if (config != null) {
      return config;
    }
View Full Code Here


    }
   
    @Override
    public void run() {
      while (true) {
        ByteSequence row = null;
        int count = 0;
       
        // all columns in a row should have the same value,
        // use this hash set to track that
        HashSet<String> values = new HashSet<String>();
       
        for (Entry<Key,Value> entry : scanner) {
          if (row == null)
            row = entry.getKey().getRowData();
         
          if (!row.equals(entry.getKey().getRowData())) {
            if (count != NUM_COLUMNS)
              System.err.println("ERROR Did not see " + NUM_COLUMNS + " columns in row " + row);
           
            if (values.size() > 1)
              System.err.println("ERROR Columns in row " + row + " had multiple values " + values);
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();
      MutableLong 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 MutableLong(0);
        columnFamilies.put(new ArrayByteSequence(cf.getBackingArray(), cf.offset(), cf.length()), count);
       
      }
     
      count.increment();
     
View Full Code Here

    for (int i = 0; i < keys.size(); i++) {
      Key k = keys.get(i);
      Value v = values.get(i);
      // 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();
View Full Code Here

          // it is quicker to call next if we are close, but we never know if we are close
          // so give next a try a few times
          getSource().next();
          count++;
        } else {
          ByteSequence higherCF = sortedColFams.higher(getSource().getTopKey().getColumnFamilyData());
          if (higherCF == null) {
            // seek to the next row
            reseek(getSource().getTopKey().followingKey(PartialKey.ROW));
          } else {
            // seek to the next column family in the sorted list of column families
            reseek(new Key(getSource().getTopKey().getRowData().toArray(), higherCF.toArray(), new byte[0], new byte[0], Long.MAX_VALUE));
          }
         
          count = 0;
        }
      }
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

    // 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

    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

   
    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

       
        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

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.