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();
}
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();
}
}
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();
}
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);
}
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);
}
Aggregations