Search in sources :

Example 1 with DGRowPacket

use of com.actiontech.dble.backend.mysql.nio.handler.query.impl.groupby.directgroupby.DGRowPacket in project dble by actiontech.

the class DirectGroupByHandler method rowResponse.

@Override
public boolean rowResponse(byte[] rowNull, final RowDataPacket rowPacket, boolean isLeft, BackendConnection conn) {
    LOGGER.debug("rowResponse");
    if (terminate.get())
        return true;
    hasFirstRow.compareAndSet(false, true);
    try {
        DGRowPacket row = new DGRowPacket(rowPacket, this.referredSumFunctions.size());
        queue.put(row);
    } catch (InterruptedException e) {
    // ignore error
    }
    return false;
}
Also used : DGRowPacket(com.actiontech.dble.backend.mysql.nio.handler.query.impl.groupby.directgroupby.DGRowPacket)

Example 2 with DGRowPacket

use of com.actiontech.dble.backend.mysql.nio.handler.query.impl.groupby.directgroupby.DGRowPacket in project dble by actiontech.

the class GroupByLocalResult method onFirstGroupRow.

protected void onFirstGroupRow(RowDataPacket row) {
    // we need to calculate group by
    initSumFunctions(this.sums, row);
    for (int i = 0; i < this.sums.size(); i++) {
        ItemSum sum = this.sums.get(i);
        Object b = sum.getTransAggObj();
        int transSize = sum.getTransSize();
        ((DGRowPacket) row).setSumTran(i, b, transSize);
    }
}
Also used : ItemSum(com.actiontech.dble.plan.common.item.function.sumfunc.ItemSum) DGRowPacket(com.actiontech.dble.backend.mysql.nio.handler.query.impl.groupby.directgroupby.DGRowPacket)

Example 3 with DGRowPacket

use of com.actiontech.dble.backend.mysql.nio.handler.query.impl.groupby.directgroupby.DGRowPacket in project dble by actiontech.

the class GroupResultDiskBuffer method onFoundRow.

@Override
protected void onFoundRow(RowDataPacket oldRow, RowDataPacket row) {
    // we need to calculate group by
    initSumFunctions(this.sums, oldRow);
    updateSumFunc(this.sums, row);
    for (int i = 0; i < this.sums.size(); i++) {
        ItemSum sum = this.sums.get(i);
        Object b = sum.getTransAggObj();
        int transSize = sum.getTransSize();
        ((DGRowPacket) oldRow).setSumTran(i, b, transSize);
    }
}
Also used : ItemSum(com.actiontech.dble.plan.common.item.function.sumfunc.ItemSum) DGRowPacket(com.actiontech.dble.backend.mysql.nio.handler.query.impl.groupby.directgroupby.DGRowPacket)

Example 4 with DGRowPacket

use of com.actiontech.dble.backend.mysql.nio.handler.query.impl.groupby.directgroupby.DGRowPacket in project dble by actiontech.

the class GroupByLocalResult method onFoundRow.

protected void onFoundRow(RowDataPacket oldRow, RowDataPacket row) {
    // we need to calculate group by
    initSumFunctions(this.sums, oldRow);
    updateSumFunc(this.sums, row);
    for (int i = 0; i < this.sums.size(); i++) {
        ItemSum sum = this.sums.get(i);
        Object b = sum.getTransAggObj();
        int transSize = sum.getTransSize();
        ((DGRowPacket) oldRow).setSumTran(i, b, transSize);
    }
}
Also used : ItemSum(com.actiontech.dble.plan.common.item.function.sumfunc.ItemSum) DGRowPacket(com.actiontech.dble.backend.mysql.nio.handler.query.impl.groupby.directgroupby.DGRowPacket)

Example 5 with DGRowPacket

use of com.actiontech.dble.backend.mysql.nio.handler.query.impl.groupby.directgroupby.DGRowPacket in project dble by actiontech.

the class GroupByLocalResult method initSumFunctions.

protected void initSumFunctions(List<ItemSum> functions, RowDataPacket row) {
    for (int i = 0; i < functions.size(); i++) {
        ItemSum sum = functions.get(i);
        Object transObj = ((DGRowPacket) row).getSumTran(i);
        sum.resetAndAdd(row, transObj);
    }
}
Also used : ItemSum(com.actiontech.dble.plan.common.item.function.sumfunc.ItemSum) DGRowPacket(com.actiontech.dble.backend.mysql.nio.handler.query.impl.groupby.directgroupby.DGRowPacket)

Aggregations

DGRowPacket (com.actiontech.dble.backend.mysql.nio.handler.query.impl.groupby.directgroupby.DGRowPacket)9 ItemSum (com.actiontech.dble.plan.common.item.function.sumfunc.ItemSum)8