io.airlift.stats.cardinality.HyperLogLog.estimatedInMemorySize()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(137)

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

HyperLogLog.estimatedInMemorySize介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

@Override
  public long getEstimatedSize()
  {
    long estimatedSize = INSTANCE_SIZE;
    if (hll != null) {
      estimatedSize += hll.estimatedInMemorySize();
    }
    return estimatedSize;
  }
}

代码示例来源:origin: prestodb/presto

public int estimatedInMemorySize()
{
  return hll.estimatedInMemorySize() + minhash.size() * SIZE_OF_ENTRY + SIZE_OF_SETDIGEST + SIZE_OF_RBTREEMAP;
}

代码示例来源:origin: prestodb/presto

private static void merge(@AggregationState HyperLogLogState state, HyperLogLog input)
{
  HyperLogLog previous = state.getHyperLogLog();
  if (previous == null) {
    state.setHyperLogLog(input);
    state.addMemoryUsage(input.estimatedInMemorySize());
  }
  else {
    state.addMemoryUsage(-previous.estimatedInMemorySize());
    previous.mergeWith(input);
    state.addMemoryUsage(previous.estimatedInMemorySize());
  }
}

代码示例来源:origin: prestodb/presto

@InputFunction
public static void input(@AggregationState HyperLogLogState state, @SqlType(StandardTypes.DOUBLE) double value)
{
  HyperLogLog hll = getOrCreateHyperLogLog(state);
  state.addMemoryUsage(-hll.estimatedInMemorySize());
  hll.add(Double.doubleToLongBits(value));
  state.addMemoryUsage(hll.estimatedInMemorySize());
}

代码示例来源:origin: prestodb/presto

@InputFunction
public static void input(@AggregationState HyperLogLogState state, @SqlType(StandardTypes.BIGINT) long value)
{
  HyperLogLog hll = getOrCreateHyperLogLog(state);
  state.addMemoryUsage(-hll.estimatedInMemorySize());
  hll.add(value);
  state.addMemoryUsage(hll.estimatedInMemorySize());
}

代码示例来源:origin: prestodb/presto

@CombineFunction
public static void combineState(@AggregationState HyperLogLogState state, @AggregationState HyperLogLogState otherState)
{
  HyperLogLog input = otherState.getHyperLogLog();
  HyperLogLog previous = state.getHyperLogLog();
  if (previous == null) {
    state.setHyperLogLog(input);
    state.addMemoryUsage(input.estimatedInMemorySize());
  }
  else {
    state.addMemoryUsage(-previous.estimatedInMemorySize());
    previous.mergeWith(input);
    state.addMemoryUsage(previous.estimatedInMemorySize());
  }
}

代码示例来源:origin: prestodb/presto

@CombineFunction
public static void combineState(@AggregationState HyperLogLogState state, @AggregationState HyperLogLogState otherState)
{
  HyperLogLog input = otherState.getHyperLogLog();
  HyperLogLog previous = state.getHyperLogLog();
  if (previous == null) {
    state.setHyperLogLog(input);
    state.addMemoryUsage(input.estimatedInMemorySize());
  }
  else {
    state.addMemoryUsage(-previous.estimatedInMemorySize());
    previous.mergeWith(input);
    state.addMemoryUsage(previous.estimatedInMemorySize());
  }
}

代码示例来源:origin: prestodb/presto

@InputFunction
@LiteralParameters("x")
public static void input(@AggregationState HyperLogLogState state, @SqlType("varchar(x)") Slice value)
{
  HyperLogLog hll = getOrCreateHyperLogLog(state);
  state.addMemoryUsage(-hll.estimatedInMemorySize());
  hll.add(value);
  state.addMemoryUsage(hll.estimatedInMemorySize());
}

代码示例来源:origin: prestodb/presto

private static HyperLogLog getOrCreateHyperLogLog(@AggregationState HyperLogLogState state)
{
  HyperLogLog hll = state.getHyperLogLog();
  if (hll == null) {
    hll = newHyperLogLog();
    state.setHyperLogLog(hll);
    state.addMemoryUsage(hll.estimatedInMemorySize());
  }
  return hll;
}

代码示例来源:origin: prestodb/presto

private static HyperLogLog getOrCreateHyperLogLog(HyperLogLogState state, double maxStandardError)
{
  HyperLogLog hll = state.getHyperLogLog();
  if (hll == null) {
    hll = HyperLogLog.newInstance(standardErrorToBuckets(maxStandardError));
    state.setHyperLogLog(hll);
    state.addMemoryUsage(hll.estimatedInMemorySize());
  }
  return hll;
}

代码示例来源:origin: prestodb/presto

@InputFunction
@TypeParameter("T")
public static void input(
    @OperatorDependency(operator = XX_HASH_64, returnType = StandardTypes.BIGINT, argumentTypes = {"T"}) MethodHandle methodHandle,
    @AggregationState HyperLogLogState state,
    @SqlType("T") double value,
    @SqlType(StandardTypes.DOUBLE) double maxStandardError)
{
  HyperLogLog hll = getOrCreateHyperLogLog(state, maxStandardError);
  state.addMemoryUsage(-hll.estimatedInMemorySize());
  long hash;
  try {
    hash = (long) methodHandle.invokeExact(value);
  }
  catch (Throwable t) {
    throw internalError(t);
  }
  hll.addHash(hash);
  state.addMemoryUsage(hll.estimatedInMemorySize());
}

代码示例来源:origin: prestodb/presto

@InputFunction
@TypeParameter("T")
public static void input(
    @OperatorDependency(operator = XX_HASH_64, returnType = StandardTypes.BIGINT, argumentTypes = {"T"}) MethodHandle methodHandle,
    @AggregationState HyperLogLogState state,
    @SqlType("T") Slice value,
    @SqlType(StandardTypes.DOUBLE) double maxStandardError)
{
  HyperLogLog hll = getOrCreateHyperLogLog(state, maxStandardError);
  state.addMemoryUsage(-hll.estimatedInMemorySize());
  long hash;
  try {
    hash = (long) methodHandle.invokeExact(value);
  }
  catch (Throwable t) {
    throw internalError(t);
  }
  hll.addHash(hash);
  state.addMemoryUsage(hll.estimatedInMemorySize());
}

代码示例来源:origin: prestodb/presto

@InputFunction
@TypeParameter("T")
public static void input(
    @OperatorDependency(operator = XX_HASH_64, returnType = StandardTypes.BIGINT, argumentTypes = {"T"}) MethodHandle methodHandle,
    @AggregationState HyperLogLogState state,
    @SqlType("T") long value,
    @SqlType(StandardTypes.DOUBLE) double maxStandardError)
{
  HyperLogLog hll = getOrCreateHyperLogLog(state, maxStandardError);
  state.addMemoryUsage(-hll.estimatedInMemorySize());
  long hash;
  try {
    hash = (long) methodHandle.invokeExact(value);
  }
  catch (Throwable t) {
    throw internalError(t);
  }
  hll.addHash(hash);
  state.addMemoryUsage(hll.estimatedInMemorySize());
}

代码示例来源:origin: prestosql/presto

@Override
  public long getEstimatedSize()
  {
    long estimatedSize = INSTANCE_SIZE;
    if (hll != null) {
      estimatedSize += hll.estimatedInMemorySize();
    }
    return estimatedSize;
  }
}

代码示例来源:origin: prestosql/presto

private static void merge(@AggregationState HyperLogLogState state, HyperLogLog input)
{
  HyperLogLog previous = state.getHyperLogLog();
  if (previous == null) {
    state.setHyperLogLog(input);
    state.addMemoryUsage(input.estimatedInMemorySize());
  }
  else {
    state.addMemoryUsage(-previous.estimatedInMemorySize());
    previous.mergeWith(input);
    state.addMemoryUsage(previous.estimatedInMemorySize());
  }
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

@InputFunction
public static void input(HyperLogLogState state, @SqlType(StandardTypes.VARCHAR) Slice value)
{
  HyperLogLog hll = getOrCreateHyperLogLog(state);
  state.addMemoryUsage(-hll.estimatedInMemorySize());
  hll.add(value);
  state.addMemoryUsage(hll.estimatedInMemorySize());
}

代码示例来源:origin: io.prestosql/presto-main

@InputFunction
public static void input(@AggregationState HyperLogLogState state, @SqlType(StandardTypes.BIGINT) long value)
{
  HyperLogLog hll = getOrCreateHyperLogLog(state);
  state.addMemoryUsage(-hll.estimatedInMemorySize());
  hll.add(value);
  state.addMemoryUsage(hll.estimatedInMemorySize());
}

代码示例来源:origin: io.prestosql/presto-main

@InputFunction
@LiteralParameters("x")
public static void input(@AggregationState HyperLogLogState state, @SqlType("varchar(x)") Slice value)
{
  HyperLogLog hll = getOrCreateHyperLogLog(state);
  state.addMemoryUsage(-hll.estimatedInMemorySize());
  hll.add(value);
  state.addMemoryUsage(hll.estimatedInMemorySize());
}

代码示例来源:origin: io.prestosql/presto-main

private static HyperLogLog getOrCreateHyperLogLog(@AggregationState HyperLogLogState state)
{
  HyperLogLog hll = state.getHyperLogLog();
  if (hll == null) {
    hll = newHyperLogLog();
    state.setHyperLogLog(hll);
    state.addMemoryUsage(hll.estimatedInMemorySize());
  }
  return hll;
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

private static HyperLogLog getOrCreateHyperLogLog(HyperLogLogState state, double maxStandardError)
{
  HyperLogLog hll = state.getHyperLogLog();
  if (hll == null) {
    hll = HyperLogLog.newInstance(standardErrorToBuckets(maxStandardError));
    state.setHyperLogLog(hll);
    state.addMemoryUsage(hll.estimatedInMemorySize());
  }
  return hll;
}

相关文章