Search in sources :

Example 1 with Serde

use of org.apache.apex.malhar.lib.appdata.gpo.Serde in project apex-malhar by apache.

the class AggregatorUtils method getOutputFieldsDescriptor.

public static FieldsDescriptor getOutputFieldsDescriptor(FieldsDescriptor inputFieldsDescriptor, CompositeAggregator compositeAggregator) {
    Map<String, Type> fieldToType = Maps.newHashMap();
    Map<String, Serde> fieldToSerde = Maps.newHashMap();
    for (Map.Entry<String, Type> entry : inputFieldsDescriptor.getFieldToType().entrySet()) {
        String fieldName = entry.getKey();
        Type outputType = compositeAggregator.getOutputType();
        fieldToType.put(fieldName, outputType);
        fieldToSerde.put(fieldName, SerdeMapPrimitive.INSTANCE);
    }
    return new FieldsDescriptor(fieldToType, fieldToSerde);
}
Also used : Serde(org.apache.apex.malhar.lib.appdata.gpo.Serde) Type(org.apache.apex.malhar.lib.appdata.schemas.Type) FieldsDescriptor(org.apache.apex.malhar.lib.appdata.schemas.FieldsDescriptor) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 Serde (org.apache.apex.malhar.lib.appdata.gpo.Serde)1 FieldsDescriptor (org.apache.apex.malhar.lib.appdata.schemas.FieldsDescriptor)1 Type (org.apache.apex.malhar.lib.appdata.schemas.Type)1