public class GroupData extends Object implements Serializable
Number
, so
that is what this class stores. It is Serializable
.
It can compute all the operations if presented with a BulletRecord
, merge other GroupData and
present the results of the operations as a BulletRecord.Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
fieldAliases |
protected Map<String,String> |
groupFields |
protected Map<GroupOperation,Number> |
metrics |
static long |
serialVersionUID |
Constructor and Description |
---|
GroupData(Map<String,String> groupFields,
Map<String,String> fieldAliases,
Map<GroupOperation,Number> metrics)
Constructor that initializes the GroupData with an existing
Map of GroupOperation to values and
a Map of Strings that represent the group fields. |
GroupData(Map<String,String> groupFields,
Set<GroupOperation> operations)
Constructor that initializes the GroupData with a
Set of GroupOperation and a Map of
Strings that represent the group fields. |
GroupData(Set<GroupOperation> operations)
Constructor that initializes the GroupData with a
Set of GroupOperation . |
Modifier and Type | Method and Description |
---|---|
void |
combine(byte[] serializedGroupData)
Merges the serialized form of a GroupData into this.
|
void |
combine(GroupData otherData)
Merge a GroupData into this.
|
void |
consume(com.yahoo.bullet.record.BulletRecord data)
Consumes the given
BulletRecord and computes group operation metrics. |
com.yahoo.bullet.record.BulletRecord |
getAsBulletRecord(com.yahoo.bullet.record.BulletRecordProvider provider)
Gets the metrics and the group values stored as a
BulletRecord . |
com.yahoo.bullet.record.BulletRecord |
getAsBulletRecord(Map<String,String> mapping,
com.yahoo.bullet.record.BulletRecordProvider provider)
Gets the metrics and the group values stored as a
BulletRecord . |
com.yahoo.bullet.record.BulletRecord |
getMetricsAsBulletRecord(com.yahoo.bullet.record.BulletRecordProvider provider)
Gets the metrics stored for the group as a
BulletRecord . |
static String |
getResultName(GroupOperation operation)
Returns the name of the result field to use for the given
GroupOperation . |
static Map<GroupOperation,Number> |
makeInitialMetrics(Set<GroupOperation> operations)
|
public static final long serialVersionUID
protected Map<GroupOperation,Number> metrics
public GroupData(Map<String,String> groupFields, Set<GroupOperation> operations)
Set
of GroupOperation
and a Map
of
Strings that represent the group fields.groupFields
- The mappings of field names to their values that represent this group.operations
- The non-null operations that this will compute metrics for.public GroupData(Set<GroupOperation> operations)
Set
of GroupOperation
.operations
- the non-null operations that this will compute metrics for.public GroupData(Map<String,String> groupFields, Map<String,String> fieldAliases, Map<GroupOperation,Number> metrics)
Map
of GroupOperation
to values and
a Map
of Strings that represent the group fields. These arguments are not copied.groupFields
- The mapping of field names to their values that represent this group.fieldAliases
- The mapping of field names to their aliases.metrics
- The non-null Map
of metrics for this object.public static Map<GroupOperation,Number> makeInitialMetrics(Set<GroupOperation> operations)
operations
- A set of operations.public void consume(com.yahoo.bullet.record.BulletRecord data)
BulletRecord
and computes group operation metrics.data
- The record to compute metrics for.public void combine(byte[] serializedGroupData)
serializedGroupData
- the serialized bytes of a GroupData.public void combine(GroupData otherData)
otherData
- The other GroupData to merge.public com.yahoo.bullet.record.BulletRecord getMetricsAsBulletRecord(com.yahoo.bullet.record.BulletRecordProvider provider)
BulletRecord
.provider
- A BulletRecordProvider to generate BulletRecords.BulletRecord
containing the data stored in this object.public com.yahoo.bullet.record.BulletRecord getAsBulletRecord(com.yahoo.bullet.record.BulletRecordProvider provider)
BulletRecord
.provider
- A BulletRecordProvider to generate BulletRecords.BulletRecord
containing the data stored in this object.public com.yahoo.bullet.record.BulletRecord getAsBulletRecord(Map<String,String> mapping, com.yahoo.bullet.record.BulletRecordProvider provider)
BulletRecord
.mapping
- An non-null new name mapping for the names of the group fields.provider
- A BulletRecordProvider to generate BulletRecords.BulletRecord
containing the data stored in this object.public static String getResultName(GroupOperation operation)
GroupOperation
.operation
- The operation to get the name for.Copyright © 2021. All rights reserved.