Java Code Examples for org.apache.hadoop.hbase.CellUtil#makeColumn()

The following examples show how to use org.apache.hadoop.hbase.CellUtil#makeColumn() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GroupingTableMap.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * Extract columns values from the current record. This method returns
 * null if any of the columns are not found.
 *
 * Override this method if you want to deal with nulls differently.
 *
 * @param r
 * @return array of byte values
 */
protected byte[][] extractKeyValues(Result r) {
  byte[][] keyVals = null;
  ArrayList<byte[]> foundList = new ArrayList<>();
  int numCols = columns.length;
  if (numCols > 0) {
    for (Cell value: r.listCells()) {
      byte [] column = CellUtil.makeColumn(CellUtil.cloneFamily(value),
          CellUtil.cloneQualifier(value));
      for (int i = 0; i < numCols; i++) {
        if (Bytes.equals(column, columns[i])) {
          foundList.add(CellUtil.cloneValue(value));
          break;
        }
      }
    }
    if(foundList.size() == numCols) {
      keyVals = foundList.toArray(new byte[numCols][]);
    }
  }
  return keyVals;
}
 
Example 2
Source File: GroupingTableMapper.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * Extract columns values from the current record. This method returns
 * null if any of the columns are not found.
 * <p>
 * Override this method if you want to deal with nulls differently.
 *
 * @param r  The current values.
 * @return Array of byte values.
 */
protected byte[][] extractKeyValues(Result r) {
  byte[][] keyVals = null;
  ArrayList<byte[]> foundList = new ArrayList<>();
  int numCols = columns.length;
  if (numCols > 0) {
    for (Cell value: r.listCells()) {
      byte [] column = CellUtil.makeColumn(CellUtil.cloneFamily(value),
          CellUtil.cloneQualifier(value));
      for (int i = 0; i < numCols; i++) {
        if (Bytes.equals(column, columns[i])) {
          foundList.add(CellUtil.cloneValue(value));
          break;
        }
      }
    }
    if(foundList.size() == numCols) {
      keyVals = foundList.toArray(new byte[numCols][]);
    }
  }
  return keyVals;
}
 
Example 3
Source File: CellModel.java    From hbase with Apache License 2.0 3 votes vote down vote up
/**
 * Constructor
 * @param column
 * @param qualifier
 * @param timestamp
 * @param value
 */
public CellModel(byte[] column, byte[] qualifier, long timestamp,
    byte[] value) {
  this.column = CellUtil.makeColumn(column, qualifier);
  this.timestamp = timestamp;
  this.value = value;
}