Package org.apache.accumulo.core.data

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


    }
   
    @Override
    public void run() {
      while (!stop) {
        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


    private static final Text CQ = new Text("cq:");

    @Override
    public void map(Key key, Value value, Context context) throws IOException, InterruptedException {
      temp.set(CF);
      ByteSequence cf = key.getColumnFamilyData();
      temp.append(cf.getBackingArray(), cf.offset(), cf.length());
      context.write(temp, EMPTY);

      temp.set(CQ);
      ByteSequence cq = key.getColumnQualifierData();
      temp.append(cq.getBackingArray(), cq.offset(), cq.length());
      context.write(temp, EMPTY);
    }
View Full Code Here

   *          the key to test
   * @return {@code true} if the key is visible or iterator is not scanning, and {@code false} if not
   */
  protected boolean canSee(Key key) {
    // Ensure that the visibility (which could have been transformed) parses. Must always do this check, even if visibility is not evaluated.
    ByteSequence visibility = key.getColumnVisibilityData();
    ColumnVisibility colVis = null;
    Boolean parsed = (Boolean) parsedVisibilitiesCache.get(visibility);
    if (parsed == null) {
      try {
        colVis = new ColumnVisibility(visibility.toArray());
        parsedVisibilitiesCache.put(visibility, Boolean.TRUE);
      } catch (BadArgumentException e) {
        log.error("Parse error after transformation : " + visibility);
        parsedVisibilitiesCache.put(visibility, Boolean.FALSE);
        if (scanning) {
          return false;
        } else {
          throw e;
        }
      }
    } else if (!parsed) {
      if (scanning)
        return false;
      else
        throw new IllegalStateException();
    }

    Boolean visible = canSeeColumnFamily(key);

    if (!scanning || !visible || ve == null || visibleCache == null || visibility.length() == 0)
      return visible;

    visible = (Boolean) visibleCache.get(visibility);
    if (visible == null) {
      try {
        if (colVis == null)
          colVis = new ColumnVisibility(visibility.toArray());
        visible = ve.evaluate(colVis);
        visibleCache.put(visibility, visible);
      } catch (VisibilityParseException e) {
        log.error("Parse Error", e);
        visible = Boolean.FALSE;
View Full Code Here

    this.key = key;
   
    fieldsSame = 0;
    fieldsPrefixed = 0;
   
    ByteSequence prevKeyScratch;
    ByteSequence keyScratch;
   
    if (prevKey != null) {
     
      prevKeyScratch = prevKey.getRowData();
      keyScratch = key.getRowData();
View Full Code Here

    // this method mostly avoids object allocation and only does compares when the row changes
   
    MutableByteSequence row, cf, cq, cv;
    MutableByteSequence 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

   * @return {@code true} if {@code key}'s column family is one of those fetched in the set passed to our {@link #seek(Range, Collection, boolean)} method
   */
  protected boolean canSeeColumnFamily(Key key) {
    boolean visible = true;
    if (seekColumnFamilies != null) {
      ByteSequence columnFamily = key.getColumnFamilyData();
      if (seekColumnFamiliesInclusive)
        visible = seekColumnFamilies.contains(columnFamily);
      else
        visible = !seekColumnFamilies.contains(columnFamily);
    }
View Full Code Here

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

  @Override
  public 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 Key(keyData, 1.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

 
  @Override
  public 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 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.