datafu-pig/src/main/java/datafu/pig/stats/DoubleVAR.java [217:260]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            } else {
                sawNonNull = true;
            }
            sum += d;
            sumSquare += dSquare;
            totalCount += count;
        }
        if(sawNonNull) {
            output.set(0, new Double(sum));
            output.set(1, new Double(sumSquare));
        } else {
            output.set(0, null);
            output.set(1, null);
        }
        output.set(2, Long.valueOf(totalCount));
        return output;
    }

    static protected long count(Tuple input) throws ExecException {
        DataBag values = (DataBag)input.get(0);
        long cnt = 0;
        Iterator<Tuple> it = values.iterator();
        while (it.hasNext()){
            Tuple t = (Tuple)it.next();
            if (t != null && t.size() > 0 && t.get(0) != null)
                cnt ++;
        }
                    
        return cnt;
    }

    static protected Double sum(Tuple input) throws ExecException, IOException {
        DataBag values = (DataBag)input.get(0);
       
        // if we were handed an empty bag, return NULL
        if(values.size() == 0) {
            return null;
        }

        double sum = 0;
        boolean sawNonNull = false;
        for (Iterator<Tuple> it = values.iterator(); it.hasNext();) {
            Tuple t = it.next();
            try{
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



datafu-pig/src/main/java/datafu/pig/stats/VAR.java [233:276]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            } else {
                sawNonNull = true;
            }
            sum += d;
            sumSquare += dSquare;
            totalCount += count;
        }
        if(sawNonNull) {
            output.set(0, new Double(sum));
            output.set(1, new Double(sumSquare));
        } else {
            output.set(0, null);
            output.set(1, null);
        }
        output.set(2, Long.valueOf(totalCount));
        return output;
    }

    static protected long count(Tuple input) throws ExecException {
        DataBag values = (DataBag)input.get(0);
        long cnt = 0;
        Iterator<Tuple> it = values.iterator();
        while (it.hasNext()){
            Tuple t = (Tuple)it.next();
            if (t != null && t.size() > 0 && t.get(0) != null)
                cnt ++;
        }
                    
        return cnt;
    }

    static protected Double sum(Tuple input) throws ExecException, IOException {
        DataBag values = (DataBag)input.get(0);
        
        // if we were handed an empty bag, return NULL
        if(values.size() == 0) {
            return null;
        }

        double sum = 0;
        boolean sawNonNull = false;
        for (Iterator<Tuple> it = values.iterator(); it.hasNext();) {
            Tuple t = it.next();
            try{
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



