Class SeriesAggregator
The request names a window, a bucket unit, up to three SeriesAggregator.Request.filters() for the app's own row query.
Fields used by allowFields(String...). A bad request
throws SeriesAggregator.RequestException (HTTP 400, E-75). At most maxBuckets(int) result cells are kept; rows that
would open another cell are dropped and the result is marked truncated.
A group value is the text of the row's value, or null (JSON
Example:
- Since:
- 10.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA parsed aggregate request.static final classA rejected aggregate request: HTTP 400 with an E-75 message.static final classAn aggregate result in columnar form: the dims, their types, and one value list per dim. -
Method Summary
Modifier and TypeMethodDescriptionaggregate(SeriesAggregator.Request req, Stream<? extends SeriesSource.Row> rows) Aggregates the rows in one pass.allowFields(String... names) The fields a request may group by or measure.static SeriesAggregatorcreate()A new aggregator.maxBuckets(int value) The most result cells (bucket and group combinations).The column holding each row's time.The first day of aweek bucket.
-
Method Details
-
create
A new aggregator. Defaults: time fieldtime , weeks start on Monday, at most 10,000 cells, no fields allowed.- Returns:
- A new aggregator.
-
timeField
The column holding each row's time.- Parameters:
value- The column name.- Returns:
- This object.
-
weekStart
The first day of aweek bucket.- Parameters:
value- The day.- Returns:
- This object.
-
maxBuckets
The most result cells (bucket and group combinations).- Parameters:
value- The cap. At least 1.- Returns:
- This object.
-
allowFields
The fields a request may group by or measure. With none, every such field is rejected.- Parameters:
names- The field names.- Returns:
- This object.
-
aggregate
public SeriesAggregator.Result aggregate(SeriesAggregator.Request req, Stream<? extends SeriesSource.Row> rows) Aggregates the rows in one pass. Rows with a null or out-of-window time are skipped.- Parameters:
req- The request.rows- The rows, already filtered by the app.- Returns:
- The result.
- Throws:
SeriesAggregator.RequestException- If the request names a field that is not allowed.
-