Java Code Examples for com.tdunning.math.stats.AVLTreeDigest#fromBytes()

The following examples show how to use com.tdunning.math.stats.AVLTreeDigest#fromBytes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OnlineStatisticsProvider.java    From metron with Apache License 2.0 6 votes vote down vote up
@Override
public void read(Kryo kryo, Input input) {
  int digestSize = input.readInt();
  byte[] digestBytes = input.readBytes(digestSize);
  ByteBuffer digestBuff = ByteBuffer.wrap(digestBytes);
  digest = AVLTreeDigest.fromBytes(digestBuff);
  n = input.readLong();
  sum = input.readDouble();
  sumOfSquares = input.readDouble();
  sumOfLogs = input.readDouble();
  min = input.readDouble();
  max = input.readDouble();
  M1 = input.readDouble();
  M2 = input.readDouble();
  M3 = input.readDouble();
  M4 = input.readDouble();
}
 
Example 2
Source File: PercentileCounter.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
public int peekLength(ByteBuffer in) {
    int mark = in.position();
    AVLTreeDigest.fromBytes(in);
    int total = in.position() - mark;
    in.position(mark);
    return total;
}
 
Example 3
Source File: PercentileAgg.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public void merge(Object facetResult, Context mcontext) {
  byte[] arr = (byte[])facetResult;
  if (arr == null) return; // an explicit null can mean no values in the field
  AVLTreeDigest subDigest = AVLTreeDigest.fromBytes(ByteBuffer.wrap(arr));
  if (digest == null) {
    digest = subDigest;
  } else {
    digest.add(subDigest);
  }
}
 
Example 4
Source File: PercentileCounter.java    From kylin with Apache License 2.0 5 votes vote down vote up
public int peekLength(ByteBuffer in) {
    int mark = in.position();
    AVLTreeDigest.fromBytes(in);
    int total = in.position() - mark;
    in.position(mark);
    return total;
}
 
Example 5
Source File: PercentileCounter.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
public void readRegisters(ByteBuffer in) {
    registers = AVLTreeDigest.fromBytes(in);
    compression = registers.compression();
}
 
Example 6
Source File: PercentileCounter.java    From kylin with Apache License 2.0 4 votes vote down vote up
public void readRegisters(ByteBuffer in) {
    registers = AVLTreeDigest.fromBytes(in);
    compression = registers.compression();
}