@Override public void process(Map<String, DimensionObject<String>> tuple) { for (Map.Entry<String, DimensionObject<String>> e : tuple.entrySet()) { Map<String, MutableDouble> obj = dataMap.get(e.getKey()); DimensionObject<String> eObj = e.getValue(); if (obj == null) { obj = new HashMap<String, MutableDouble>(); obj.put(eObj.getVal(), new MutableDouble(eObj.getCount())); dataMap.put(e.getKey(), obj); } else { MutableDouble n = obj.get(eObj.getVal()); if (n == null) { obj.put(eObj.getVal(), new MutableDouble(eObj.getCount())); } else { n.add(eObj.getCount()); } } } }
@Override public void process(String timeBucket, String key, String field, Number value) { String finalKey = timeBucket + "|" + key; Map<String, Number> m = dataMap.get(finalKey); if (value == null) { return; } if (m == null) { m = new HashMap<String, Number>(); m.put(field, new MutableDouble(value)); dataMap.put(finalKey, m); } else { Number n = m.get(field); if (n == null) { m.put(field, new MutableDouble(value)); } else { ((MutableDouble) n).add(value); } } }