/// <summary>the map function.</summary> /// <remarks> /// the map function. It iterates through the value aggregator descriptor /// list to generate aggregation id/value pairs and emit them. /// </remarks> /// <exception cref="System.IO.IOException"/> public override void Map(K1 key, V1 value, OutputCollector <Text, Text> output, Reporter reporter) { IEnumerator iter = this.aggregatorDescriptorList.GetEnumerator(); while (iter.HasNext()) { ValueAggregatorDescriptor ad = (ValueAggregatorDescriptor)iter.Next(); IEnumerator <KeyValuePair <Text, Text> > ens = ad.GenerateKeyValPairs(key, value).GetEnumerator (); while (ens.HasNext()) { KeyValuePair <Text, Text> en = ens.Next(); output.Collect(en.Key, en.Value); } } }
private static AList <ValueAggregatorDescriptor> GetAggregatorDescriptors(JobConf job) { string advn = "aggregator.descriptor"; int num = job.GetInt(advn + ".num", 0); AList <ValueAggregatorDescriptor> retv = new AList <ValueAggregatorDescriptor>(num); for (int i = 0; i < num; i++) { string spec = job.Get(advn + "." + i); ValueAggregatorDescriptor ad = GetValueAggregatorDescriptor(spec, job); if (ad != null) { retv.AddItem(ad); } } return(retv); }