@Override public LongAnalysisCounter add(Writable writable) { long value = writable.toLong(); if (value == 0) countZero++; if (value == getMinValueSeen()) countMinValue++; else if (value < getMinValueSeen()) { countMinValue = 1; } if (value == getMaxValueSeen()) countMaxValue++; else if (value > getMaxValueSeen()) { countMaxValue = 1; } if (value >= 0) { countPositive++; } else { countNegative++; } ; counter.merge((double) value); return this; }
@Override public LongAnalysisCounter add(Writable writable) { long value = writable.toLong(); if (value == 0) countZero++; if (value == getMinValueSeen()) countMinValue++; else if (value < getMinValueSeen()) { countMinValue = 1; } if (value == getMaxValueSeen()) countMaxValue++; else if (value > getMaxValueSeen()) { countMaxValue = 1; } if (value >= 0) { countPositive++; } else { countNegative++; } ; counter.merge((double) value); return this; }
public LongAnalysisCounter merge(LongAnalysisCounter other) { long otherMin = other.getMinValueSeen(); long newCountMinValue; if (getMinValueSeen() == otherMin) { newCountMinValue = countMinValue + other.getCountMinValue(); } else if (getMinValueSeen() > otherMin) { //Keep other, take count from other newCountMinValue = other.getCountMinValue(); } else { //Keep this min, no change to count newCountMinValue = countMinValue; } long otherMax = other.getMaxValueSeen(); long newCountMaxValue; if (getMaxValueSeen() == otherMax) { newCountMaxValue = countMaxValue + other.getCountMaxValue(); } else if (getMaxValueSeen() < otherMax) { //Keep other, take count from other newCountMaxValue = other.getCountMaxValue(); } else { //Keep this max, no change to count newCountMaxValue = countMaxValue; } return new LongAnalysisCounter(counter.merge(other.getCounter()), countZero + other.getCountZero(), newCountMinValue, newCountMaxValue, countPositive + other.getCountPositive(), countNegative + other.getCountNegative()); } }
public LongAnalysisCounter merge(LongAnalysisCounter other) { long otherMin = other.getMinValueSeen(); long newCountMinValue; if (getMinValueSeen() == otherMin) { newCountMinValue = countMinValue + other.getCountMinValue(); } else if (getMinValueSeen() > otherMin) { //Keep other, take count from other newCountMinValue = other.getCountMinValue(); } else { //Keep this min, no change to count newCountMinValue = countMinValue; } long otherMax = other.getMaxValueSeen(); long newCountMaxValue; if (getMaxValueSeen() == otherMax) { newCountMaxValue = countMaxValue + other.getCountMaxValue(); } else if (getMaxValueSeen() < otherMax) { //Keep other, take count from other newCountMaxValue = other.getCountMaxValue(); } else { //Keep this max, no change to count newCountMaxValue = countMaxValue; } return new LongAnalysisCounter(counter.merge(other.getCounter()), countZero + other.getCountZero(), newCountMinValue, newCountMaxValue, countPositive + other.getCountPositive(), countNegative + other.getCountNegative()); } }
LongAnalysisCounter lac = (LongAnalysisCounter) counters.get(i); LongAnalysis la = new LongAnalysis.Builder().min(lac.getMinValueSeen()).max(lac.getMaxValueSeen()) .mean(lac.getMean()).sampleStdev(lac.getSampleStdev()) .sampleVariance(lac.getSampleVariance()).countZero(lac.getCountZero()) minsMaxes[i][1] = lac.getMaxValueSeen(); .max(lac2.getMaxValueSeen()).mean(lac2.getMean()).sampleStdev(lac2.getSampleStdev()) .sampleVariance(lac2.getSampleVariance()).countZero(lac2.getCountZero()) .countNegative(lac2.getCountNegative()).countPositive(lac2.getCountPositive()) minsMaxes[i][1] = lac2.getMaxValueSeen();
LongAnalysisCounter lac = (LongAnalysisCounter) counters.get(i); LongAnalysis la = new LongAnalysis.Builder().min(lac.getMinValueSeen()).max(lac.getMaxValueSeen()) .mean(lac.getMean()).sampleStdev(lac.getSampleStdev()) .sampleVariance(lac.getSampleVariance()).countZero(lac.getCountZero()) minsMaxes[i][1] = lac.getMaxValueSeen(); .max(lac2.getMaxValueSeen()).mean(lac2.getMean()).sampleStdev(lac2.getSampleStdev()) .sampleVariance(lac2.getSampleVariance()).countZero(lac2.getCountZero()) .countNegative(lac2.getCountNegative()).countPositive(lac2.getCountPositive()) minsMaxes[i][1] = lac2.getMaxValueSeen();