Search in sources :

Example 1 with UnSortedLocalResult

use of com.actiontech.dble.backend.mysql.store.UnSortedLocalResult in project dble by actiontech.

the class NotInHandler method addEndRowToDeque.

/**
 * only for terminate.
 *
 * @param row
 * @param columnCount
 * @param deque
 * @throws InterruptedException
 */
private void addEndRowToDeque(RowDataPacket row, int columnCount, FairLinkedBlockingDeque<LocalResult> deque) throws InterruptedException {
    LocalResult newLocalResult = new UnSortedLocalResult(columnCount, pool, this.charset).setMemSizeController(session.getJoinBufferMC());
    newLocalResult.add(row);
    newLocalResult.done();
    LocalResult localResult = deque.addOrReplaceLast(newLocalResult);
    if (localResult != null)
        localResult.close();
}
Also used : LocalResult(com.actiontech.dble.backend.mysql.store.LocalResult) UnSortedLocalResult(com.actiontech.dble.backend.mysql.store.UnSortedLocalResult) UnSortedLocalResult(com.actiontech.dble.backend.mysql.store.UnSortedLocalResult)

Example 2 with UnSortedLocalResult

use of com.actiontech.dble.backend.mysql.store.UnSortedLocalResult in project dble by actiontech.

the class TempTableHandler method fieldEofResponse.

@Override
public void fieldEofResponse(byte[] headerNull, List<byte[]> fieldsNull, List<FieldPacket> fieldPackets, byte[] eofNull, boolean isLeft, BackendConnection conn) {
    if (terminate.get()) {
        return;
    }
    lock.lock();
    try {
        if (this.fieldPackets.isEmpty()) {
            this.fieldPackets = fieldPackets;
            tempTable.setFieldPackets(this.fieldPackets);
            tempTable.setCharset(conn.getCharset().getResults());
            tempTable.setRowsStore(new UnSortedLocalResult(fieldPackets.size(), DbleServer.getInstance().getBufferPool(), CharsetUtil.getJavaCharset(conn.getCharset().getResults())).setMemSizeController(session.getOtherBufferMC()));
            List<Field> fields = HandlerTool.createFields(this.fieldPackets);
            sourceSelIndex = HandlerTool.findField(sourceSel, fields, 0);
            if (sourceSelIndex < 0)
                throw new TempTableException("sourcesel [" + sourceSel.toString() + "] not found in fields");
            sourceField = fields.get(sourceSelIndex);
            if (nextHandler != null) {
                nextHandler.fieldEofResponse(headerNull, fieldsNull, fieldPackets, eofNull, this.isLeft, conn);
            } else {
                throw new TempTableException("unexpected nextHandler is null");
            }
        }
    } finally {
        lock.unlock();
    }
}
Also used : Field(com.actiontech.dble.plan.common.field.Field) TempTableException(com.actiontech.dble.plan.common.exception.TempTableException) UnSortedLocalResult(com.actiontech.dble.backend.mysql.store.UnSortedLocalResult)

Example 3 with UnSortedLocalResult

use of com.actiontech.dble.backend.mysql.store.UnSortedLocalResult in project dble by actiontech.

the class JoinHandler method addEndRowToDeque.

/**
 * only for terminate.
 *
 * @param row
 * @param columnCount
 * @param deque
 * @throws InterruptedException
 */
private void addEndRowToDeque(RowDataPacket row, int columnCount, FairLinkedBlockingDeque<LocalResult> deque) throws InterruptedException {
    LocalResult newLocalResult = new UnSortedLocalResult(columnCount, pool, this.charset).setMemSizeController(session.getJoinBufferMC());
    newLocalResult.add(row);
    newLocalResult.done();
    LocalResult localResult = deque.addOrReplaceLast(newLocalResult);
    if (localResult != null)
        localResult.close();
}
Also used : LocalResult(com.actiontech.dble.backend.mysql.store.LocalResult) UnSortedLocalResult(com.actiontech.dble.backend.mysql.store.UnSortedLocalResult) UnSortedLocalResult(com.actiontech.dble.backend.mysql.store.UnSortedLocalResult)

Example 4 with UnSortedLocalResult

use of com.actiontech.dble.backend.mysql.store.UnSortedLocalResult in project dble by actiontech.

the class JoinHandler method addRowToDeque.

private void addRowToDeque(RowDataPacket row, int columnCount, FairLinkedBlockingDeque<LocalResult> deque, RowDataComparator cmp) throws InterruptedException {
    LocalResult localResult = deque.peekLast();
    if (localResult != null) {
        RowDataPacket lastRow = localResult.getLastRow();
        if (lastRow.getFieldCount() == 0) {
            // eof may added in terminateThread
            return;
        } else if (row.getFieldCount() > 0 && cmp.compare(lastRow, row) == 0) {
            localResult.add(row);
            return;
        } else {
            localResult.done();
        }
    }
    LocalResult newLocalResult = new UnSortedLocalResult(columnCount, pool, this.charset).setMemSizeController(session.getJoinBufferMC());
    newLocalResult.add(row);
    if (row.getFieldCount() == 0)
        newLocalResult.done();
    deque.putLast(newLocalResult);
}
Also used : LocalResult(com.actiontech.dble.backend.mysql.store.LocalResult) UnSortedLocalResult(com.actiontech.dble.backend.mysql.store.UnSortedLocalResult) RowDataPacket(com.actiontech.dble.net.mysql.RowDataPacket) UnSortedLocalResult(com.actiontech.dble.backend.mysql.store.UnSortedLocalResult)

Example 5 with UnSortedLocalResult

use of com.actiontech.dble.backend.mysql.store.UnSortedLocalResult in project dble by actiontech.

the class NotInHandler method addRowToDeque.

private void addRowToDeque(RowDataPacket row, int columnCount, FairLinkedBlockingDeque<LocalResult> deque, RowDataComparator cmp) throws InterruptedException {
    LocalResult localResult = deque.peekLast();
    if (localResult != null) {
        RowDataPacket lastRow = localResult.getLastRow();
        if (lastRow.getFieldCount() == 0) {
            return;
        } else if (row.getFieldCount() > 0 && cmp.compare(lastRow, row) == 0) {
            localResult.add(row);
            return;
        } else {
            localResult.done();
        }
    }
    LocalResult newLocalResult = new UnSortedLocalResult(columnCount, pool, this.charset).setMemSizeController(session.getJoinBufferMC());
    newLocalResult.add(row);
    if (row.getFieldCount() == 0)
        newLocalResult.done();
    deque.putLast(newLocalResult);
}
Also used : LocalResult(com.actiontech.dble.backend.mysql.store.LocalResult) UnSortedLocalResult(com.actiontech.dble.backend.mysql.store.UnSortedLocalResult) RowDataPacket(com.actiontech.dble.net.mysql.RowDataPacket) UnSortedLocalResult(com.actiontech.dble.backend.mysql.store.UnSortedLocalResult)

Aggregations

UnSortedLocalResult (com.actiontech.dble.backend.mysql.store.UnSortedLocalResult)5 LocalResult (com.actiontech.dble.backend.mysql.store.LocalResult)4 RowDataPacket (com.actiontech.dble.net.mysql.RowDataPacket)2 TempTableException (com.actiontech.dble.plan.common.exception.TempTableException)1 Field (com.actiontech.dble.plan.common.field.Field)1