当前位置: 首页>>代码示例>>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;未经允许,请勿转载。