Package edu.caltech.nanodb.queryeval
Class StatisticsUpdater
- java.lang.Object
-
- edu.caltech.nanodb.queryeval.StatisticsUpdater
-
public class StatisticsUpdater extends java.lang.Object
This helper class provides basic functionality for updating column statistics based on a selection predicate. The supported predicates are very limited, because the problem becomes very grungy for arbitrary predicates. Supported predicates include:- A single comparison between a column and a value
- A Boolean AND expression, although only the column-value comparisons within the expression will be used to update statistics
-
-
Constructor Summary
Constructors Modifier Constructor Description private
StatisticsUpdater()
This class should not be instantiated.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
updateCompareStats(CompareOperator comp, Schema schema, java.util.List<ColumnStats> stats)
Try to update the column-statistics based on the passed-in comparison operation.static java.util.ArrayList<ColumnStats>
updateStats(Expression expr, Schema schema, java.util.List<ColumnStats> inputStats)
This static helper takes a selection predicate, a schema the predicate is evaluated against, and input column-statistics, and produces output column-statistics that reflect the input arguments.
-
-
-
Method Detail
-
updateStats
public static java.util.ArrayList<ColumnStats> updateStats(Expression expr, Schema schema, java.util.List<ColumnStats> inputStats)
This static helper takes a selection predicate, a schema the predicate is evaluated against, and input column-statistics, and produces output column-statistics that reflect the input arguments. The output is a deep-copy of the input, so that no accidental side-effects occur.
Only a very limited number of selection predicates are supported, all centering around conjunctive selection based on "COLUMN op VALUE" components. Other kinds of predicates will not be used to update the statistics.
If a predicate includes a column-reference that is not part of the input schema, then that part of the predicate will be ignored.
- Parameters:
expr
- the selection predicateschema
- the schema that the selection predicate is evaluated againstinputStats
- the column statistics of the input tuple-sequence that will be filtered by the selection predicate- Returns:
- estimated column statistics
-
updateCompareStats
private static void updateCompareStats(CompareOperator comp, Schema schema, java.util.List<ColumnStats> stats)
Try to update the column-statistics based on the passed-in comparison operation. Updates will only occur if the comparison is of the form "COLUMN = VALUE".- Parameters:
comp
- The comparison operation to considerschema
- The schema that the operation is evaluated againststats
- the statistics to update based on the comparison
-
-