org.apache.hadoop.hbase.client.Increment.getFamilyMap()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中org.apache.hadoop.hbase.client.Increment.getFamilyMap()方法的一些代码示例,展示了Increment.getFamilyMap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Increment.getFamilyMap()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Increment
类名称:Increment
方法名:getFamilyMap

Increment.getFamilyMap介绍

[英]Method for retrieving the increment's familyMap
[中]用于检索增量的familyMap的方法

代码示例

代码示例来源:origin: jrkinley/storm-hbase

/**
 * Increment the counter for the given family and column by the specified amount
 * <p>
 * If the family and column already exist in the Increment the counter value is incremented by the
 * specified amount rather than overridden, as it is in HBase's
 * {@link Increment#addColumn(byte[], byte[], long)} method
 * @param inc The {@link Increment} to update
 * @param family The column family
 * @param qualifier The column qualifier
 * @param amount The amount to increment the counter by
 */
public static void addIncrement(Increment inc, final byte[] family, final byte[] qualifier,
  final Long amount) {
 NavigableMap<byte[], Long> set = inc.getFamilyMap().get(family);
 if (set == null) {
  set = new TreeMap<byte[], Long>(Bytes.BYTES_COMPARATOR);
 }
 // If qualifier exists, increment amount
 Long counter = set.get(qualifier);
 if (counter == null) {
  counter = 0L;
 }
 set.put(qualifier, amount + counter);
 inc.getFamilyMap().put(family, set);
}

代码示例来源:origin: forcedotcom/phoenix

for (Map.Entry<byte[],NavigableMap<byte[], Long>> entry : increment.getFamilyMap().entrySet()) {
  byte[] cf = entry.getKey();
  for (byte[] cq : entry.getValue().keySet()) {

代码示例来源:origin: jrkinley/storm-hbase

/** {@inheritDoc} */
@Override
public void execute(Tuple tuple) {
 Increment newInc = conf.getIncrementFromTuple(tuple, TupleTableConfig.DEFAULT_INCREMENT);
 Increment extInc = counters.get(newInc.getRow());
 if (extInc != null) {
  // Increment already exists for row, add newInc to extInc
  for (Entry<byte[], NavigableMap<byte[], Long>> families : newInc.getFamilyMap().entrySet()) {
   for (Entry<byte[], Long> columns : families.getValue().entrySet()) {
    TupleTableConfig.addIncrement(extInc, families.getKey(), columns.getKey(),
     columns.getValue());
   }
  }
  counters.put(newInc.getRow(), extInc);
 } else {
  counters.put(newInc.getRow(), newInc);
 }
}

代码示例来源:origin: jrkinley/storm-hbase

for (Entry<byte[], NavigableMap<byte[], Long>> e : inc.getFamilyMap().entrySet()) {

代码示例来源:origin: urbanairship/datacube

@Override
  public Object answer(InvocationOnMock a) throws Throwable {
    List<Increment> increments = (List<Increment>) a.getArguments()[0];
    Object[] objects = (Object[]) a.getArguments()[1];
    int size = increments.size();
    List<Row> failedOperations = new ArrayList<>();
    List<Throwable> throwables = new ArrayList<>();
    List<String> hosts = new ArrayList<>();
    for (int i = 0; i < size; ++i) {
      if (i % 2 == 1) {
        failedOperations.add(increments.get(i));
        throwables.add(new IOException("ughhh " + i));
        hosts.add("host: " + i);
        objects[i] = null;
      } else {
        incrementOperations.add(increments.get(i));
        objects[i] = new Result(new KeyValue[]{new KeyValue(
            increments.get(i).getRow(),
            CF,
            HBaseDbHarness.QUALIFIER,
            Longs.toByteArray(increments.get(i).getFamilyMap().get(CF).get(HBaseDbHarness.QUALIFIER))
        )});
      }
    }
    if (!failedOperations.isEmpty()) {
      throw new RetriesExhaustedWithDetailsException(throwables, failedOperations, hosts);
    }
    return objects;
  }
}

代码示例来源:origin: co.cask.hbase/hbase

increment.getFamilyMap().entrySet()) {
closeRegionOperation();
long after = EnvironmentEdgeManager.currentTimeMillis();
this.opMetrics.updateIncrementMetrics(increment.getFamilyMap().keySet(), after - before);

相关文章