public void accumulate()

in datafu-pig/src/main/java/datafu/pig/stats/IntVAR.java [320:353]


    public void accumulate(Tuple b) throws IOException {
        try {
            Long sum = sum(b);
            if(sum == null) {
                return;
            }
            
            Long sumSquare = sumSquare(b);
            if(sumSquare == null) {
                return;
            }
            
            // set default values
            if (intermediateSum == null || intermediateCount == null) {
                intermediateSumSquare = (long) 0;
                intermediateSum = (long) 0;
                intermediateCount = (long) 0;
            }
            
            long count = (Long)count(b);

            if (count > 0) {
                intermediateCount += count;
                intermediateSum += sum;
                intermediateSumSquare += sumSquare;
            }
        } catch (ExecException ee) {
            throw ee;
        } catch (Exception e) {
            int errCode = 2106;
            String msg = "Error while computing variance in " + this.getClass().getSimpleName();
            throw new ExecException(msg, errCode, PigException.BUG, e);
        }
    }