當前位置: 首頁>>代碼示例>>Java>>正文


Java ImmutableBytesWritable.get方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.io.ImmutableBytesWritable.get方法的典型用法代碼示例。如果您正苦於以下問題:Java ImmutableBytesWritable.get方法的具體用法?Java ImmutableBytesWritable.get怎麽用?Java ImmutableBytesWritable.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.io.ImmutableBytesWritable的用法示例。


在下文中一共展示了ImmutableBytesWritable.get方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: map

import org.apache.hadoop.hbase.io.ImmutableBytesWritable; //導入方法依賴的package包/類
@Override
public void map(ImmutableBytesWritable key, Result result,
    Context context)
throws IOException {
  List<Long> tsList = new ArrayList<Long>();
  for (Cell kv : result.listCells()) {
    tsList.add(kv.getTimestamp());
  }

  List<Put> puts = new ArrayList<>();
  for (Long ts : tsList) {
    Put put = new Put(key.get());
    put.setDurability(Durability.SKIP_WAL);
    put.add(FAMILY_NAME, COLUMN_NAME, ts, Bytes.toBytes(true));
    puts.add(put);
  }
  table.put(puts);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:19,代碼來源:TestTimeRangeMapRed.java

示例2: map

import org.apache.hadoop.hbase.io.ImmutableBytesWritable; //導入方法依賴的package包/類
/**
 * Implements mapper logic for use across APIs.
 */
protected static Put map(ImmutableBytesWritable key, Result value) throws IOException {
  if (value.size() != 1) {
    throw new IOException("There should only be one input column");
  }
  Map<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>>
    cf = value.getMap();
  if(!cf.containsKey(INPUT_FAMILY)) {
    throw new IOException("Wrong input columns. Missing: '" +
      Bytes.toString(INPUT_FAMILY) + "'.");
  }

  // Get the original value and reverse it

  String originalValue = Bytes.toString(value.getValue(INPUT_FAMILY, null));
  StringBuilder newValue = new StringBuilder(originalValue);
  newValue.reverse();

  // Now set the value to be collected

  Put outval = new Put(key.get());
  outval.add(OUTPUT_FAMILY, null, Bytes.toBytes(newValue.toString()));
  return outval;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:27,代碼來源:TestTableMapReduceBase.java

示例3: map

import org.apache.hadoop.hbase.io.ImmutableBytesWritable; //導入方法依賴的package包/類
/**
 * Pass the key, and reversed value to reduce
 *
 * @param key
 * @param value
 * @param context
 * @throws IOException
 */
public void map(ImmutableBytesWritable key, Result value,
    Context context)
        throws IOException, InterruptedException {
  if (value.size() != 1) {
    throw new IOException("There should only be one input column");
  }
  Map<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>>
  cf = value.getMap();
  if(!cf.containsKey(INPUT_FAMILY)) {
    throw new IOException("Wrong input columns. Missing: '" +
        Bytes.toString(INPUT_FAMILY) + "'.");
  }
  // Get the original value and reverse it
  String originalValue = Bytes.toString(value.getValue(INPUT_FAMILY, null));
  StringBuilder newValue = new StringBuilder(originalValue);
  newValue.reverse();
  // Now set the value to be collected
  Put outval = new Put(key.get());
  outval.add(OUTPUT_FAMILY, null, Bytes.toBytes(newValue.toString()));
  context.write(key, outval);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:30,代碼來源:TestMultithreadedTableMapper.java

示例4: verifyRowFromMap

import org.apache.hadoop.hbase.io.ImmutableBytesWritable; //導入方法依賴的package包/類
protected static void verifyRowFromMap(ImmutableBytesWritable key, Result result)
  throws IOException {
  byte[] row = key.get();
  CellScanner scanner = result.cellScanner();
  while (scanner.advance()) {
    Cell cell = scanner.current();

    //assert that all Cells in the Result have the same key
    Assert.assertEquals(0, Bytes.compareTo(row, 0, row.length,
      cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()));
  }

  for (int j = 0; j < FAMILIES.length; j++) {
    byte[] actual = result.getValue(FAMILIES[j], null);
    Assert.assertArrayEquals("Row in snapshot does not match, expected:" + Bytes.toString(row)
      + " ,actual:" + Bytes.toString(actual), row, actual);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:19,代碼來源:TableSnapshotInputFormatTestBase.java

示例5: map

import org.apache.hadoop.hbase.io.ImmutableBytesWritable; //導入方法依賴的package包/類
/**
 * Pass the key, and reversed value to reduce
 *
 * @param key
 * @param value
 * @param context
 * @throws IOException
 */
public void map(ImmutableBytesWritable key, Result value,
  Context context)
throws IOException, InterruptedException {
  if (value.size() != 1) {
    throw new IOException("There should only be one input column");
  }
  Map<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>>
    cf = value.getMap();
  if(!cf.containsKey(INPUT_FAMILY)) {
    throw new IOException("Wrong input columns. Missing: '" +
      Bytes.toString(INPUT_FAMILY) + "'.");
  }

  // Get the original value and reverse it
  String originalValue = Bytes.toString(value.getValue(INPUT_FAMILY, null));
  StringBuilder newValue = new StringBuilder(originalValue);
  newValue.reverse();
  // Now set the value to be collected
  Put outval = new Put(key.get());
  outval.add(OUTPUT_FAMILY, null, Bytes.toBytes(newValue.toString()));
  context.write(key, outval);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:31,代碼來源:TestTableMapReduce.java

示例6: map

import org.apache.hadoop.hbase.io.ImmutableBytesWritable; //導入方法依賴的package包/類
@Override
protected void map(ImmutableBytesWritable key, Result value, Context context)
    throws IOException ,InterruptedException {
  byte[] rowKey = key.get();
  row.set(rowKey, 0, rowKey.length);
  if (multipleUnevenColumnFamilies
      && (!value.containsColumn(BIG_FAMILY_NAME, BIG_FAMILY_NAME) || !value.containsColumn(
        TINY_FAMILY_NAME, TINY_FAMILY_NAME))) {
    context.write(row, DEF_LOST_FAMILIES);
  } else {
    context.write(row, DEF);
  }
  byte[] prev = value.getValue(FAMILY_NAME, COLUMN_PREV);
  if (prev != null && prev.length > 0) {
    ref.set(prev, 0, prev.length);
    context.write(ref, row);
  } else {
    LOG.warn(String.format("Prev is not set for: %s", Bytes.toStringBinary(rowKey)));
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:21,代碼來源:IntegrationTestBigLinkedList.java

示例7: map

import org.apache.hadoop.hbase.io.ImmutableBytesWritable; //導入方法依賴的package包/類
@Override
protected void map(ImmutableBytesWritable key, Result value, Context context)
    throws IOException, InterruptedException {
  BytesWritable bwKey = new BytesWritable(key.get());
  BytesWritable bwVal = new BytesWritable();
  for (Cell kv : value.listCells()) {
    if (Bytes.compareTo(TEST_QUALIFIER, 0, TEST_QUALIFIER.length,
                        kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength()) == 0) {
      context.write(bwKey, EMPTY);
    } else {
      bwVal.set(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength());
      context.write(bwVal, bwKey);
    }
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:16,代碼來源:IntegrationTestLoadAndVerify.java

示例8: getValue

import org.apache.hadoop.hbase.io.ImmutableBytesWritable; //導入方法依賴的package包/類
/**
 * @param key The key.
 * @return The value.
 */
public byte[] getValue(byte[] key) {
  ImmutableBytesWritable ibw = values.get(new ImmutableBytesWritable(key));
  if (ibw == null)
    return null;
  return ibw.get();
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:11,代碼來源:HColumnDescriptor.java

示例9: getValue

import org.apache.hadoop.hbase.io.ImmutableBytesWritable; //導入方法依賴的package包/類
private byte[] getValue(final ImmutableBytesWritable key) {
  ImmutableBytesWritable ibw = values.get(key);
  if (ibw == null)
    return null;
  return ibw.get();
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:7,代碼來源:HTableDescriptor.java


注:本文中的org.apache.hadoop.hbase.io.ImmutableBytesWritable.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。