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


Java Result.getMap方法代碼示例

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


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

示例1: map

import org.apache.hadoop.hbase.client.Result; //導入方法依賴的package包/類
/**
 * Pass the key and value to reduce.
 *
 * @param key The key, here "aaa", "aab" etc.
 * @param value The value is the same as the key.
 * @param context The task context.
 * @throws IOException When reading the rows fails.
 */
@Override
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) + "'.");
  }
  String val = Bytes.toStringBinary(value.getValue(INPUT_FAMILY, null));
  LOG.debug("map: key -> " + Bytes.toStringBinary(key.get()) +
      ", value -> " + val);
  context.write(key, key);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:26,代碼來源:TestMultiTableInputFormat.java

示例2: map

import org.apache.hadoop.hbase.client.Result; //導入方法依賴的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.client.Result; //導入方法依賴的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: map

import org.apache.hadoop.hbase.client.Result; //導入方法依賴的package包/類
/**
 * Pass the key and value to reduce.
 *
 * @param key  The key, here "aaa", "aab" etc.
 * @param value  The value is the same as the key.
 * @param context  The task context.
 * @throws IOException When reading the rows fails.
 */
@Override
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) + "'.");
  }
  String val = Bytes.toStringBinary(value.getValue(INPUT_FAMILY, null));
  LOG.info("map: key -> " + Bytes.toStringBinary(key.get()) +
    ", value -> " + val);
  context.write(key, key);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:27,代碼來源:TestTableInputFormatScanBase.java

示例5: map

import org.apache.hadoop.hbase.client.Result; //導入方法依賴的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: assertResultEquals

import org.apache.hadoop.hbase.client.Result; //導入方法依賴的package包/類
protected void assertResultEquals(final HRegion region, final byte [] row,
  final byte [] family, final byte [] qualifier, final long timestamp,
  final byte [] value)
throws IOException {
  Get get = new Get(row);
  get.setTimeStamp(timestamp);
  Result res = region.get(get);
  NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> map =
    res.getMap();
  byte [] res_value = map.get(family).get(qualifier).get(timestamp);

  if (value == null) {
    assertEquals(Bytes.toString(family) + " " + Bytes.toString(qualifier) +
        " at timestamp " + timestamp, null, res_value);
  } else {
    if (res_value == null) {
      fail(Bytes.toString(family) + " " + Bytes.toString(qualifier) +
          " at timestamp " + timestamp + "\" was expected to be \"" +
          Bytes.toStringBinary(value) + " but was null");
    }
    if (res_value != null) {
      assertEquals(Bytes.toString(family) + " " + Bytes.toString(qualifier) +
          " at timestamp " +
          timestamp, value, new String(res_value));
    }
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:28,代碼來源:HBaseTestCase.java

示例7: makeAssertions

import org.apache.hadoop.hbase.client.Result; //導入方法依賴的package包/類
public void makeAssertions(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) + "'.");
  }
  String val = Bytes.toStringBinary(value.getValue(INPUT_FAMILY, null));
  LOG.debug("map: key -> " + Bytes.toStringBinary(key.get()) +
      ", value -> " + val);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:15,代碼來源:MultiTableInputFormatTestBase.java


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