当前位置: 首页>>代码示例>>Java>>正文


Java HyperLogLog.addAll方法代码示例

本文整理汇总了Java中com.clearspring.analytics.stream.cardinality.HyperLogLog.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java HyperLogLog.addAll方法的具体用法?Java HyperLogLog.addAll怎么用?Java HyperLogLog.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.clearspring.analytics.stream.cardinality.HyperLogLog的用法示例。


在下文中一共展示了HyperLogLog.addAll方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: count

import com.clearspring.analytics.stream.cardinality.HyperLogLog; //导入方法依赖的package包/类
@Override
public long count() {
    final Iterator<HyperLogLog> it = states.iterator();

    if (!it.hasNext()) {
        return 0L;
    }

    HyperLogLog current = it.next();

    while (it.hasNext()) {
        try {
            current.addAll(it.next());
        } catch (CardinalityMergeException e) {
            throw new RuntimeException(e);
        }
    }

    return current.cardinality();
}
 
开发者ID:spotify,项目名称:heroic,代码行数:21,代码来源:ReduceHyperLogLogCardinalityBucket.java

示例2: combine

import com.clearspring.analytics.stream.cardinality.HyperLogLog; //导入方法依赖的package包/类
@Override
public List<HyperLogLog> combine(List<HyperLogLog> aggregationResultList, CombineLevel combineLevel) {
  if ((aggregationResultList == null) || aggregationResultList.isEmpty()) {
    return null;
  }
  HyperLogLog hllResult = aggregationResultList.get(0);
  for (int i = 1; i < aggregationResultList.size(); ++i) {
    try {
      hllResult.addAll(aggregationResultList.get(i));
    } catch (CardinalityMergeException e) {
      LOGGER.error("Caught exception while merging Cardinality using HyperLogLog", e);
      Utils.rethrowException(e);
    }
  }
  aggregationResultList.clear();
  aggregationResultList.add(hllResult);
  return aggregationResultList;
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:19,代码来源:DistinctCountHLLAggregationFunction.java

示例3: combineTwoValues

import com.clearspring.analytics.stream.cardinality.HyperLogLog; //导入方法依赖的package包/类
@Override
public HyperLogLog combineTwoValues(HyperLogLog aggregationResult0, HyperLogLog aggregationResult1) {
  if (aggregationResult0 == null) {
    return aggregationResult1;
  }
  if (aggregationResult1 == null) {
    return aggregationResult0;
  }
  try {
    aggregationResult0.addAll(aggregationResult1);
  } catch (CardinalityMergeException e) {
    LOGGER.error("Caught exception while merging Cardinality using HyperLogLog", e);
    Utils.rethrowException(e);
  }
  return aggregationResult0;
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:17,代码来源:DistinctCountHLLAggregationFunction.java

示例4: reduce

import com.clearspring.analytics.stream.cardinality.HyperLogLog; //导入方法依赖的package包/类
@Override
public Long reduce(List<HyperLogLog> combinedResultList) {
  if ((combinedResultList == null) || combinedResultList.isEmpty()) {
    return 0L;
  }
  HyperLogLog reducedResult = combinedResultList.get(0);
  for (int i = 1; i < combinedResultList.size(); ++i) {
    try {
      reducedResult.addAll(combinedResultList.get(i));
    } catch (CardinalityMergeException e) {
      LOGGER.error("Caught exception while merging Cardinality using HyperLogLog", e);
      Utils.rethrowException(e);
    }
  }
  return reducedResult.cardinality();
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:17,代码来源:DistinctCountHLLAggregationFunction.java

示例5: main

import com.clearspring.analytics.stream.cardinality.HyperLogLog; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, CardinalityMergeException {
  HyperLogLog hll = new HyperLogLog(12);
  for (int i = 0; i < 25; i++) {
    hll.offer(i);
  }
  System.out.println(hll.cardinality());
  byte[] bytes =hll.getBytes();
  HyperLogLog hll2 = new HyperLogLog(12);
  HyperLogLog other = HyperLogLog.Builder.build(bytes);
  hll2.addAll(other);
  System.out.println(hll2.cardinality());
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:13,代码来源:StatisticsAggrFunctions.java

示例6: mergeTest

import com.clearspring.analytics.stream.cardinality.HyperLogLog; //导入方法依赖的package包/类
@Test
public void mergeTest() throws CardinalityMergeException {

    SiteSession siteSessionA = new SiteSession("user1", 100, "testURL-A");
    siteSessionA.update(100, "testURL-common");
    SiteSession siteSessionB = new SiteSession("user1", 100, "testURL-B");
    siteSessionB.update(100, "testURL-common");

    HyperLogLog hll = siteSessionA.getHyperLogLog();
    hll.addAll(siteSessionB.getHyperLogLog());

    assertEquals(3, hll.cardinality());
}
 
开发者ID:jhalliday,项目名称:csc8101,代码行数:14,代码来源:SiteSessionTest.java

示例7: merge

import com.clearspring.analytics.stream.cardinality.HyperLogLog; //导入方法依赖的package包/类
@Nonnull
@Override
public HyperLogLog merge(@Nonnull HyperLogLog intermediateResult1, @Nonnull HyperLogLog intermediateResult2) {
  try {
    intermediateResult1.addAll(intermediateResult2);
  } catch (CardinalityMergeException e) {
    throw new RuntimeException("Caught exception while merging HyperLogLog.", e);
  }
  return intermediateResult1;
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:11,代码来源:DistinctCountHLLAggregationFunction.java

示例8: clone

import com.clearspring.analytics.stream.cardinality.HyperLogLog; //导入方法依赖的package包/类
public static HyperLogLog clone(HyperLogLog hll, int log2m) {
  try {
    HyperLogLog ret = new HyperLogLog(log2m);
    ret.addAll(hll);
    return ret;
  } catch (CardinalityMergeException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:10,代码来源:HllUtil.java

示例9: mergeHLLResultsToFirstInList

import com.clearspring.analytics.stream.cardinality.HyperLogLog; //导入方法依赖的package包/类
/**
 * Merge all HLLs in list to the first HLL in the list, the list must contain at least one element
 * @param resultList
 * @return
 */
public static HyperLogLog mergeHLLResultsToFirstInList(List<HyperLogLog> resultList) {
  HyperLogLog hllResult = resultList.get(0);
  for (int i = 1; i < resultList.size(); ++i) {
    try {
      hllResult.addAll(resultList.get(i));
    } catch (CardinalityMergeException e) {
      Utils.rethrowException(e);
    }
  }
  return hllResult;
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:17,代码来源:HllUtil.java


注:本文中的com.clearspring.analytics.stream.cardinality.HyperLogLog.addAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。