Package edu.caltech.nanodb.queryeval
Class ColumnStats
- java.lang.Object
-
- edu.caltech.nanodb.queryeval.ColumnStats
-
public class ColumnStats extends java.lang.Object
This class holds some useful statistics for a specific column. At present this consists of the following:- the number of unique values in the column (not including NULL in the count)
- the number of NULL values in the column
- the minimum value for the column
- the maximum value for the column
ColumnStatsCollector
class can be used to easily collect these statistics for a particular column of a table.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
maxValue
The maximum value of this column in the table, or null if the maximum value is unknown.private java.lang.Object
minValue
The minimum value of this column in the table, or null if the minimum value is unknown.private int
numNullValues
The total number of NULL values for this column in the table, or -1 if the total number of NULL values is unknown.private int
numUniqueValues
The total number of unique values for this column in the table, or -1 if the total number of unique values is unknown.
-
Constructor Summary
Constructors Constructor Description ColumnStats()
Initializes a column-stats object to all "unknown" values.ColumnStats(int numUniqueValues, int numNullValues, java.lang.Object minValue, java.lang.Object maxValue)
Initializes a column-stats object with the specified values.ColumnStats(ColumnStats stats)
Copies another column-stats object into this object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
getMaxValue()
Returns the maximum value for the column.java.lang.Object
getMinValue()
Returns the minimum value for the column.int
getNumNullValues()
Returns the number of NULL values for the column, or -1 if the number is unknownint
getNumUniqueValues()
Returns the number of unique values for the column, or -1 if the number is unknownboolean
hasDifferentMinMaxValues()
Returns true if this column-stats object has both minimum and maximum values, and they are actually different values.boolean
hasMinMaxValues()
Returns true if this column-stats object has both minimum and maximum values.void
setMaxValue(java.lang.Object maxValue)
Sets the maximum value for the column.void
setMinValue(java.lang.Object minValue)
Sets the minimum value for the column.void
setNumNullValues(int num)
Sets the number of NULL values for the column.void
setNumUniqueValues(int num)
Sets the number of unique values for the column.
-
-
-
Field Detail
-
numUniqueValues
private int numUniqueValues
The total number of unique values for this column in the table, or -1 if the total number of unique values is unknown.
-
numNullValues
private int numNullValues
The total number of NULL values for this column in the table, or -1 if the total number of NULL values is unknown.
-
minValue
private java.lang.Object minValue
The minimum value of this column in the table, or null if the minimum value is unknown.
-
maxValue
private java.lang.Object maxValue
The maximum value of this column in the table, or null if the maximum value is unknown.
-
-
Constructor Detail
-
ColumnStats
public ColumnStats(int numUniqueValues, int numNullValues, java.lang.Object minValue, java.lang.Object maxValue)
Initializes a column-stats object with the specified values.- Parameters:
numUniqueValues
- the number of unique values in the column, or -1 if unknownnumNullValues
- the number of NULL values in the column, or -1 if unknownminValue
- the minimum value in the column, or null if unknownmaxValue
- the maximum value in the column, or null if unknown
-
ColumnStats
public ColumnStats()
Initializes a column-stats object to all "unknown" values.
-
ColumnStats
public ColumnStats(ColumnStats stats)
Copies another column-stats object into this object.
-
-
Method Detail
-
getNumUniqueValues
public int getNumUniqueValues()
Returns the number of unique values for the column, or -1 if the number is unknown- Returns:
- the number of unique values for the column, or -1 if the number is unknown
-
setNumUniqueValues
public void setNumUniqueValues(int num)
Sets the number of unique values for the column.- Parameters:
num
- the number of unique values in the table for the column, or -1 if the number if unknown
-
getNumNullValues
public int getNumNullValues()
Returns the number of NULL values for the column, or -1 if the number is unknown- Returns:
- the number of NULL values for the column, or -1 if the number is unknown
-
setNumNullValues
public void setNumNullValues(int num)
Sets the number of NULL values for the column.- Parameters:
num
- the number of NULL values in the table for the column, or -1 if the number if unknown
-
getMinValue
public java.lang.Object getMinValue()
Returns the minimum value for the column.- Returns:
- the minimum value in the table for the column
-
setMinValue
public void setMinValue(java.lang.Object minValue)
Sets the minimum value for the column.- Parameters:
minValue
- the minimum value in the table for the column
-
getMaxValue
public java.lang.Object getMaxValue()
Returns the maximum value for the column.- Returns:
- the maximum value in the table for the column
-
setMaxValue
public void setMaxValue(java.lang.Object maxValue)
Sets the maximum value for the column.- Parameters:
maxValue
- the maximum value in the table for the column
-
hasMinMaxValues
public boolean hasMinMaxValues()
Returns true if this column-stats object has both minimum and maximum values.- Returns:
- true if this column-stats object has both minimum and maximum values
-
hasDifferentMinMaxValues
public boolean hasDifferentMinMaxValues()
Returns true if this column-stats object has both minimum and maximum values, and they are actually different values.- Returns:
- true if this column-stats object has both minimum and maximum values, and they are actually different values.
-
-