public class JsonAnalytics
extends java.lang.Object
| Constructor and Description |
|---|
JsonAnalytics() |
| Modifier and Type | Method and Description |
|---|---|
static <K extends com.google.gson.JsonElement> |
aggregate(TWindow<com.google.gson.JsonObject,K> window,
java.lang.String resultPartitionProperty,
java.lang.String valueProperty,
JsonUnivariateAggregate... aggregates)
Aggregate against a single
Numeric variable contained in an JSON object. |
static <K extends com.google.gson.JsonElement> |
aggregate(TWindow<com.google.gson.JsonObject,K> window,
java.lang.String resultPartitionProperty,
java.lang.String resultProperty,
ToDoubleFunction<com.google.gson.JsonObject> valueGetter,
JsonUnivariateAggregate... aggregates)
Aggregate against a single
Numeric variable contained in an JSON object. |
static <K extends com.google.gson.JsonElement> |
aggregateList(java.lang.String resultPartitionProperty,
java.lang.String resultProperty,
ToDoubleFunction<com.google.gson.JsonObject> valueGetter,
JsonUnivariateAggregate... aggregates)
Create a Function that aggregates against a single
Numeric
variable contained in an JSON object. |
public static <K extends com.google.gson.JsonElement> TStream<com.google.gson.JsonObject> aggregate(TWindow<com.google.gson.JsonObject,K> window, java.lang.String resultPartitionProperty, java.lang.String valueProperty, JsonUnivariateAggregate... aggregates)
Numeric variable contained in an JSON object.
The returned stream contains a tuple for each execution performed against a window partition.
The tuple is a JsonObject containing:
K as a property with key resultPartitionProperty. JsonObject as a property with key valueProperty.
This results object contains the results of all aggregations defined by aggregates against
double property with key valueProperty.
JsonUnivariateAggregate declares how it represents its aggregation in this result
object.
For example if the window contains these three tuples (pseudo JSON) for
partition 3:
{id=3,reading=2.0}, {id=3,reading=2.6}, {id=3,reading=1.8}
the resulting aggregation for the stream returned by:
aggregate(window, "id", "reading", Statistic.MIN, Statistic.MAX)
would contain this tuple with the maximum and minimum values in the reading
JSON object:
{id=3, reading={MIN=1.8, MAX=1.8}}
K - Partition typewindow - Window to aggregate over.resultPartitionProperty - Property to store the partition key in tuples on the returned stream.valueProperty - JSON property containing the value to aggregate.aggregates - Which aggregations to be performed.public static <K extends com.google.gson.JsonElement> TStream<com.google.gson.JsonObject> aggregate(TWindow<com.google.gson.JsonObject,K> window, java.lang.String resultPartitionProperty, java.lang.String resultProperty, ToDoubleFunction<com.google.gson.JsonObject> valueGetter, JsonUnivariateAggregate... aggregates)
Numeric variable contained in an JSON object.
The returned stream contains a tuple for each execution performed against a window partition.
The tuple is a JsonObject containing:
K as a property with key resultPartitionProperty. JsonObject as a property with key resultProperty.
This results object contains the results of all aggregations defined by aggregates against
value returned by valueGetter.
JsonUnivariateAggregate declares how it represents its aggregation in this result
object.
K - Partition typewindow - Window to aggregate over.resultPartitionProperty - Property to store the partition key in tuples on the returned stream.resultProperty - Property to store the aggregations in tuples on the returned stream.valueGetter - How to obtain the single variable from input tuples.aggregates - Which aggregations to be performed.public static <K extends com.google.gson.JsonElement> BiFunction<java.util.List<com.google.gson.JsonObject>,K,com.google.gson.JsonObject> aggregateList(java.lang.String resultPartitionProperty, java.lang.String resultProperty, ToDoubleFunction<com.google.gson.JsonObject> valueGetter, JsonUnivariateAggregate... aggregates)
Numeric
variable contained in an JSON object.
Calling apply(List<JsonObject>) on the returned BiFunction
returns a JsonObject containing:
K as a property with key resultPartitionProperty. JsonObject as a property with key valueProperty.
This results object contains the results of all aggregations defined by aggregates
against the value returned by valueGetter.
JsonUnivariateAggregate declares how it represents its aggregation in this result
object.
For example if the list contains these three tuples (pseudo JSON) for
partition 3:
{id=3,reading=2.0}, {id=3,reading=2.6}, {id=3,reading=1.8}
the resulting aggregation for the JsonObject returned by:
aggregateList("id", "reading", Statistic.MIN, Statistic.MAX).apply(list, 3)
would be this tuple with the maximum and minimum values in the reading
JSON object:
{id=3, reading={MIN=1.8, MAX=1.8}}
K - Partition typeresultPartitionProperty - Property to store the partition key in tuples on the returned stream.resultProperty - Property to store the aggregations in the returned JsonObject.valueGetter - How to obtain the single variable from input tuples.aggregates - Which aggregations to be performed.Copyright IBM 2015,2016 - 2f6ad0e-20160307-0902