public class NumericHistogram extends Object
Constructor and Description |
---|
NumericHistogram()
Creates a new histogram object.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double v)
Adds a new data point to the histogram approximation.
|
void |
allocate(int num_bins)
Sets the number of histogram bins to use for approximating data.
|
org.apache.hadoop.hive.ql.udf.generic.NumericHistogram.Coord |
getBin(int b)
Returns a particular histogram bin.
|
int |
getNumBins() |
int |
getUsedBins()
Returns the number of bins currently being used by the histogram.
|
boolean |
isReady()
Returns true if this histogram object has been initialized by calling merge()
or allocate().
|
void |
merge(List other,
DoubleObjectInspector doi)
Takes a serialized histogram created by the serialize() method and merges
it with the current histogram object.
|
double |
quantile(double q)
Gets an approximate quantile value from the current histogram.
|
void |
reset()
Resets a histogram object to its initial state.
|
ArrayList<DoubleWritable> |
serialize()
In preparation for a Hive merge() call, serializes the current histogram object into an
ArrayList of DoubleWritable objects.
|
public NumericHistogram()
public void reset()
public int getUsedBins()
public boolean isReady()
public org.apache.hadoop.hive.ql.udf.generic.NumericHistogram.Coord getBin(int b)
public void allocate(int num_bins)
num_bins
- Number of non-uniform-width histogram bins to usepublic void merge(List other, DoubleObjectInspector doi)
other
- A serialized histogram created by the serialize() methodmerge(java.util.List, org.apache.hadoop.hive.serde2.objectinspector.primitive.DoubleObjectInspector)
public void add(double v)
v
- The data point to add to the histogram approximation.public double quantile(double q)
q
- The requested quantile, must be strictly within the range (0,1).public ArrayList<DoubleWritable> serialize()
merge(java.util.List, org.apache.hadoop.hive.serde2.objectinspector.primitive.DoubleObjectInspector)
public int getNumBins()
Copyright © 2017 The Apache Software Foundation. All rights reserved.