Search in sources :

Example 1 with DoublePtr

use of com.actiontech.dble.plan.common.ptr.DoublePtr in project dble by actiontech.

the class ItemSumVariance method add.

@Override
public boolean add(RowDataPacket row, Object transObj) {
    if (transObj != null) {
        useTransObj = true;
        AggData other = (AggData) transObj;
        sumAi2 += other.sumAi2;
        sumA += other.sumA;
        count += other.count;
    } else {
        /*
             * Why use a temporary variable? We don't know if it is null until
             * we evaluate it, which has the side-effect of setting null_value .
             */
        double nr = args.get(0).valReal().doubleValue();
        // add for transObj
        sumA += nr;
        sumAi2 += nr * nr;
        // end add
        if (!args.get(0).isNullValue()) {
            DoublePtr rM = new DoublePtr(recurrenceM);
            DoublePtr rS = new DoublePtr(recurrenceS);
            LongPtr countPtr = new LongPtr(count);
            varianceFpRecurrenceNext(rM, rS, countPtr, nr);
            recurrenceM = rM.get();
            recurrenceS = rS.get();
            count = countPtr.get();
        }
    }
    return false;
}
Also used : LongPtr(com.actiontech.dble.plan.common.ptr.LongPtr) DoublePtr(com.actiontech.dble.plan.common.ptr.DoublePtr)

Aggregations

DoublePtr (com.actiontech.dble.plan.common.ptr.DoublePtr)1 LongPtr (com.actiontech.dble.plan.common.ptr.LongPtr)1