|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.visualization.datasource.query.engine.TableAggregator
public class TableAggregator
Aggregates a DataTable according to specific row groups. The groups are defined by an ordered list of group-by columns. For instance, if the list is {"Name", "Revenue"} then each unique pair of values of these columns (e.g., {"John", 300}, {"John", 19}, {"Sarah", 2222}) defines a group, where the group includes all of the rows that share the values defined by the pair (for example all the rows where value("Name") = "John" and value("Cost") = 300). In addition there is a group for each unique name ({"John"}, {"Sarah"}) and an additional group that contains all the rows in the table. The groups described above are kept in an aggregation tree. The root of the tree contains aggregation information for the group of all rows. Each level of the tree (except for the root level) is associated with an aggregation column. Each node of the tree is associated with a value (of some cell in the column defining the node's level). A path in the tree from the root to a node is represented by an ordered list of values, and is associated with the group of data rows identified by this list. In our example the tree contains one path of length 0 ({}), two paths of length 1 ({"John"}, {"Sarah"}), and three paths of length two ({"John", 300}, {"John", 19}, {"Sarah", 2222}). The aggregation data stored is all aggregation data possible for the columns to aggregate (also called aggregation columns): the minimum, maximum, count, average, and sum, each of these where applicable.
| Constructor Summary | |
|---|---|
TableAggregator(java.util.List<java.lang.String> groupByColumns,
java.util.Set<java.lang.String> aggregateColumns,
DataTable table)
Constructs a table aggregator and aggregates the table. |
|
| Method Summary | |
|---|---|
Value |
getAggregationValue(AggregationPath path,
java.lang.String columnId,
AggregationType type)
Returns the aggregation value of a specific column and type. |
java.util.Set<AggregationPath> |
getPathsToLeaves()
Returns a set containing the paths to all the leaves in the tree. |
AggregationPath |
getRowPath(TableRow row,
DataTable table,
int depth)
Creates a path for the aggregation tree defined by a table row. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TableAggregator(java.util.List<java.lang.String> groupByColumns,
java.util.Set<java.lang.String> aggregateColumns,
DataTable table)
groupByColumns - An ordered list of columns to group by.aggregateColumns - A set of columns to aggregate.table - The table.| Method Detail |
|---|
public AggregationPath getRowPath(TableRow row,
DataTable table,
int depth)
row - The table row.table - The table.depth - The depth of the desired path.
public java.util.Set<AggregationPath> getPathsToLeaves()
public Value getAggregationValue(AggregationPath path,
java.lang.String columnId,
AggregationType type)
path - The aggregation path.columnId - The requested column id.type - The requested aggregation type.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||