Java Code Examples for org.apache.hadoop.hbase.client.Put.getRow()

The following are Jave code examples for showing how to use getRow() of the org.apache.hadoop.hbase.client.Put class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ditb   File: LMDIndexWriter.java   Source Code and License Vote up 6 votes
/**
 * parse put, add index put into mdRecordList
 */
private void processPut(List<KeyValue> mdRecordList, Put put) throws IOException {
  if (put == null) return;
  byte[] rawRowkey = put.getRow();
  int[] arr = new int[dimensions];
  int i = 0;
  for (Map.Entry<byte[], TreeSet<byte[]>> entry : tableRelation.getIndexFamilyMap().entrySet()) {
    for (byte[] qualifier : entry.getValue()) {
      arr[i] = Bytes.toInt(put.get(entry.getKey(), qualifier).get(0).getValue());
      ++i;
    }
  }
  byte[] mdKey = MDUtils.bitwiseZip(arr, dimensions);
  KeyValue keyValue =
      new KeyValue(mdKey, LMDIndexConstants.FAMILY, rawRowkey, put.getTimeStamp(), Type.Put,
          LMDIndexConstants.VALUE);
  mdRecordList.add(keyValue);
}
 
Example 2
Project: ditb   File: IndexPutParser.java   Source Code and License Vote up 6 votes
@Override protected Map<TableName, Put> parsePut(Put put, boolean serverSide) {
  Map<TableName, Put> map = new HashMap<>();
  byte[] row = put.getRow();
  for (Map.Entry<byte[], List<Cell>> entry : put.getFamilyCellMap().entrySet()) {
    byte[] family = entry.getKey();
    for (Cell cell : entry.getValue()) {
      byte[] q = CellUtil.cloneQualifier(cell);
      if (tableRelation.isIndexColumn(family, q)) {
        TableName indexTableName = tableRelation.getIndexTableName(family, q);
        Put newPut = new Put(getIndexRow(row, CellUtil.cloneValue(cell)));
        if (serverSide) newPut
            .addColumn(IndexType.SEDONDARY_FAMILY_BYTES, (byte[]) null, cell.getTimestamp(),
                null);
        else newPut.addColumn(IndexType.SEDONDARY_FAMILY_BYTES, null, null);
        map.put(indexTableName, newPut);
      }
    }
  }
  tableRelation.getIndexFamilyMap();
  return map;
}
 
Example 3
Project: ditb   File: PerformanceEvaluation.java   Source Code and License Vote up 5 votes
@Override
void testRow(final int i) throws IOException {
  byte [] bytes = format(i);
  // Put a known value so when we go to check it, it is there.
  Put put = new Put(bytes);
  put.addColumn(FAMILY_NAME, getQualifier(), bytes);
  this.table.put(put);
  Delete delete = new Delete(put.getRow());
  delete.addColumn(FAMILY_NAME, getQualifier());
  this.table.checkAndDelete(bytes, FAMILY_NAME, getQualifier(), CompareOp.EQUAL, bytes, delete);
}
 
Example 4
Project: ditb   File: IndexPutParser.java   Source Code and License Vote up 5 votes
/**
 * override this method to improve performance
 */
@Override protected Map<TableName, List<Put>> parsePutList(List<Put> puts, boolean serverSide) {
  Map<TableName, List<Put>> map = new TreeMap<>();
  for (Put put : puts) {
    byte[] row = put.getRow();
    for (Map.Entry<byte[], List<Cell>> entry : put.getFamilyCellMap().entrySet()) {
      byte[] family = entry.getKey();
      for (Cell cell : entry.getValue()) {
        byte[] q = CellUtil.cloneQualifier(cell);
        if (tableRelation.isIndexColumn(family, q)) {
          TableName indexTableName = tableRelation.getIndexTableName(family, q);
          List<Put> list = map.get(indexTableName);
          if (list == null) {
            list = new ArrayList<>();
            map.put(indexTableName, list);
          }
          Put newPut = new Put(getIndexRow(row, CellUtil.cloneValue(cell)));
          if (serverSide) newPut
              .addColumn(IndexType.SEDONDARY_FAMILY_BYTES, (byte[]) null, cell.getTimestamp(),
                  null);
          else newPut.addColumn(IndexType.SEDONDARY_FAMILY_BYTES, null, null);
          list.add(newPut);
        }
      }
    }
  }
  tableRelation.getIndexFamilyMap();
  return map;
}
 
Example 5
Project: ditb   File: RemoteHTable.java   Source Code and License Vote up 5 votes
protected CellSetModel buildModelFromPut(Put put) {
  RowModel row = new RowModel(put.getRow());
  long ts = put.getTimeStamp();
  for (List<Cell> cells: put.getFamilyCellMap().values()) {
    for (Cell cell: cells) {
      row.addCell(new CellModel(CellUtil.cloneFamily(cell), CellUtil.cloneQualifier(cell),
        ts != HConstants.LATEST_TIMESTAMP ? ts : cell.getTimestamp(),
        CellUtil.cloneValue(cell)));
    }
  }
  CellSetModel model = new CellSetModel();
  model.addRow(row);
  return model;
}