|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.farrago.catalog.FarragoColumnHistogram
public class FarragoColumnHistogram
FarragoColumnHistogram reads and interprets statistics for a column of a Farrago column set. An instance of this class is returned to summarize the result of applying predicate(s) to a column.
TODO: Review statistics analysis for handling of null semantics. Null values are less than all other values (e.g. bars might contain the starting values null,0,1,...). Because stats analysis is based on ranges, only ranges which include consecutive bars are supported. Examples:
Nested Class Summary | |
---|---|
private static class |
FarragoColumnHistogram.HistogramBarCoverage
Describes which points and ranges lie on a histogram bar |
private class |
FarragoColumnHistogram.HistogramRange
Histogram range represents a set of bars in a histogram |
Field Summary | |
---|---|
private int |
barCount
|
private List<FemColumnHistogramBar> |
bars
|
(package private) Double |
cardinality
|
private FemAbstractColumn |
column
|
private FemColumnHistogram |
histogram
|
private Timestamp |
labelTimestamp
|
(package private) Double |
selectivity
|
private SargIntervalSequence |
sequence
|
Constructor Summary | |
---|---|
protected |
FarragoColumnHistogram(FemAbstractColumn column,
SargIntervalSequence sequence)
Deprecated. |
protected |
FarragoColumnHistogram(FemAbstractColumn column,
SargIntervalSequence sequence,
Timestamp labelTimestamp)
Initializes a column statistics reader. |
Method Summary | |
---|---|
private boolean |
checkEndpoint(SargEndpoint endpoint)
Check if the given SargEndpoint is infinite or is bounded by a literal expression. |
protected static int |
compare(String histValue,
RexLiteral coordinate)
Compares a value in a histogram with a Sarg coordinate |
protected void |
evaluate()
Analyzes column histogram to determine the selectivity and cardinality of the specified search condition. |
Double |
getCardinality()
Estimates the number of distinct values returned from a relational expression that satisfy a given condition. |
private List<FarragoColumnHistogram.HistogramBarCoverage> |
getCoverage(SargIntervalSequence sequence)
Computes the histogram bar coverage of an ordered sequence of intervals. |
Double |
getSelectivity()
Estimates the percentage of a relational expression's rows which satisfy a given condition. |
private void |
readCoverages(List<FarragoColumnHistogram.HistogramBarCoverage> coverages)
Reads collective coverages finally make estimates on requested attributes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private FemAbstractColumn column
private SargIntervalSequence sequence
private Timestamp labelTimestamp
private FemColumnHistogram histogram
private int barCount
private List<FemColumnHistogramBar> bars
Double selectivity
Double cardinality
Constructor Detail |
---|
protected FarragoColumnHistogram(FemAbstractColumn column, SargIntervalSequence sequence)
evaluate()
.
column
- column to analyzesequence
- optional predicate on the columnprotected FarragoColumnHistogram(FemAbstractColumn column, SargIntervalSequence sequence, Timestamp labelTimestamp)
evaluate()
.
column
- column to analyzesequence
- optional predicate on the columnlabelTimestamp
- the creation timestamp of the label setting that
determines which set of stats should be used; null if there is no label
settingMethod Detail |
---|
public Double getSelectivity()
RelStatColumnStatistics
RelMetadataQuery.getSelectivity(org.eigenbase.rel.RelNode, org.eigenbase.rex.RexNode)
.
getSelectivity
in interface RelStatColumnStatistics
public Double getCardinality()
RelStatColumnStatistics
getCardinality
in interface RelStatColumnStatistics
protected void evaluate()
private List<FarragoColumnHistogram.HistogramBarCoverage> getCoverage(SargIntervalSequence sequence)
sequence
- sequence to lookup
private boolean checkEndpoint(SargEndpoint endpoint)
endpoint
- the endpoint to evaluate
private void readCoverages(List<FarragoColumnHistogram.HistogramBarCoverage> coverages)
coverages
- list of coverage for each barprotected static int compare(String histValue, RexLiteral coordinate)
histValue
- a histogram valuecoordinate
- a sarg coordinate, or a null pointer to represent the
null value. An infinite coordinate is not recognized by this function.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |