Package org.apache.hadoop.hbase.index.util

Examples of org.apache.hadoop.hbase.index.util.ByteArrayBuilder.array()


    ByteArrayBuilder value = new ByteArrayBuilder(4);
    value.put(Bytes.toBytes((short) byteArray.array().length));
    value.put(Bytes.toBytes((short) offset));
    Put p = new Put(byteArray.array());
    p.add(Constants.IDX_COL_FAMILY, Constants.IDX_COL_QUAL, value.array());
    idx_table.put(p);
    SingleColumnValueFilter filter =
        new SingleColumnValueFilter("cf1".getBytes(), "c1".getBytes(), CompareOp.EQUAL,
            "apple".getBytes());
View Full Code Here


    byte[] rowKey = kv.getRow();
    // First two bytes are going to be the
    ByteArrayBuilder keyBuilder = ByteArrayBuilder.allocate(rowKey.length);
    // Start from 2nd offset because the first 2 bytes corresponds to the rowkeylength
    keyBuilder.put(rowKey, 0, rowKey.length);
    int indexOf = com.google.common.primitives.Bytes.indexOf(keyBuilder.array(), new byte[1]);
    return keyBuilder.array(indexOf + 1, IndexUtils.getMaxIndexNameLength());
  }

  private boolean isUserTableRegionAvailable(String indexTableName, HRegion indexRegion,
      HRegionServer rs) {
View Full Code Here

    // First two bytes are going to be the
    ByteArrayBuilder keyBuilder = ByteArrayBuilder.allocate(rowKey.length);
    // Start from 2nd offset because the first 2 bytes corresponds to the rowkeylength
    keyBuilder.put(rowKey, 0, rowKey.length);
    int indexOf = com.google.common.primitives.Bytes.indexOf(keyBuilder.array(), new byte[1]);
    return keyBuilder.array(indexOf + 1, IndexUtils.getMaxIndexNameLength());
  }

  private boolean isUserTableRegionAvailable(String indexTableName, HRegion indexRegion,
      HRegionServer rs) {
    Collection<HRegion> userRegions = rs.getOnlineRegions(Bytes.toBytes(this.actualTableName));
View Full Code Here

    builder.put(regionStartKey);
    builder.position(builder.position() + 1);
    // Adding the index name and the padding needed
    builder.put(indexName);
    // No need to add the padding bytes specifically. In the array all the bytes will be 0s.
    return builder.array();
  }

  // When it comes here, only the last column in the colDetails will be a range.
  // Others will be exact value. EQUALS condition.
  private byte[] createStartOrStopKeyForIndexScan(List<FilterColumnValueDetail> colDetails,
View Full Code Here

            // We can go with the value + 1
            // For eg : if type is int and value is 45, make startkey considering value as 46
            // If type is String and value is 'ad' make startkey considering value as 'ae'

            copyColumnValueToKey(builder, fcvd.value, fcvd.maxValueLength, fcvd.valueType);
            IndexUtils.incrementValue(builder.array(), false);
          }
        } else {
          CompareOp op = fcvd.compareOp;
          byte[] value = fcvd.value;
          if (fcvd instanceof FilterColumnValueRange) {
View Full Code Here

            // possibles values for that column we need to consider. Well the max value for a
            // column with maxValueLength=10 will a byte array of 10 bytes with all bytes as FF.
            // But we can put this FF bytes into the stop row because the stop row will not be
            // considered by the scanner. So we need to increment this by 1.
            // We can increment the byte[] created until now by 1.
            byte[] stopRowTillNow = builder.array(0, builder.position());
            stopRowTillNow = IndexUtils.incrementValue(stopRowTillNow, true);
            // Now we need to copy back this incremented value to the builder.
            builder.position(0);
            builder.put(stopRowTillNow);
            // Now just advance the builder pos by fcvd.maxValueLength as we need all 0 bytes
View Full Code Here

            builder.put(stopRowTillNow);
            // Now just advance the builder pos by fcvd.maxValueLength as we need all 0 bytes
            builder.position(builder.position() + fcvd.maxValueLength);
          } else if (op.equals(CompareOp.EQUAL) || op.equals(CompareOp.LESS_OR_EQUAL)) {
            copyColumnValueToKey(builder, value, fcvd.maxValueLength, fcvd.valueType);
            IndexUtils.incrementValue(builder.array(), false);

          } else if (op.equals(CompareOp.LESS)) {
            copyColumnValueToKey(builder, value, fcvd.maxValueLength, fcvd.valueType);
          }
        }
View Full Code Here

    }
    if (userTabRowKeyLen > 0) {
      builder.put(userTabRowKey);
    }

    return builder.array();
  }

  private void copyColumnValueToKey(ByteArrayBuilder builder, byte[] colValue, int maxValueLength,
      ValueType valueType) {
    colValue = IndexUtils.changeValueAccToDataType(colValue, valueType);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.