use of com.actiontech.dble.backend.mysql.nio.handler.util.RowDataComparator in project dble by actiontech.
the class JoinHandler method fieldEofResponse.
@Override
public void fieldEofResponse(byte[] headerNull, List<byte[]> fieldsNull, final List<FieldPacket> fieldPackets, byte[] eofNull, boolean isLeft, final BackendConnection conn) {
if (this.pool == null)
this.pool = DbleServer.getInstance().getBufferPool();
if (isLeft) {
// logger.debug("field eof left");
leftFieldPackets = fieldPackets;
leftComparator = new RowDataComparator(leftFieldPackets, leftOrders, this.isAllPushDown(), this.type());
} else {
// logger.debug("field eof right");
rightFieldPackets = fieldPackets;
rightComparator = new RowDataComparator(rightFieldPackets, rightOrders, this.isAllPushDown(), this.type());
}
if (!fieldSent.compareAndSet(false, true)) {
this.charset = CharsetUtil.getJavaCharset(conn.getCharset().getResults());
List<FieldPacket> newFieldPacket = new ArrayList<>();
newFieldPacket.addAll(leftFieldPackets);
newFieldPacket.addAll(rightFieldPackets);
nextHandler.fieldEofResponse(null, null, newFieldPacket, null, this.isLeft, conn);
otherJoinOnItem = makeOtherJoinOnItem(newFieldPacket, conn);
// logger.debug("all ready");
startOwnThread(conn);
}
}
use of com.actiontech.dble.backend.mysql.nio.handler.util.RowDataComparator in project dble by actiontech.
the class NotInHandler method fieldEofResponse.
@Override
public void fieldEofResponse(byte[] headerNull, List<byte[]> fieldsNull, final List<FieldPacket> fieldPackets, byte[] eofNull, boolean isLeft, final BackendConnection conn) {
if (this.pool == null)
this.pool = DbleServer.getInstance().getBufferPool();
if (isLeft) {
// logger.debug("field eof left");
leftFieldPackets = fieldPackets;
leftComparator = new RowDataComparator(leftFieldPackets, leftOrders, this.isAllPushDown(), this.type());
} else {
// logger.debug("field eof right");
rightFieldPackets = fieldPackets;
rightComparator = new RowDataComparator(rightFieldPackets, rightOrders, this.isAllPushDown(), this.type());
}
if (!fieldSent.compareAndSet(false, true)) {
this.charset = CharsetUtil.getJavaCharset(conn.getCharset().getResults());
nextHandler.fieldEofResponse(null, null, leftFieldPackets, null, this.isLeft, conn);
// logger.debug("all ready");
startOwnThread(conn);
}
}
use of com.actiontech.dble.backend.mysql.nio.handler.util.RowDataComparator in project dble by actiontech.
the class AllAnySubQueryHandler 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 {
// create field for first time
if (this.fieldPackets.isEmpty()) {
this.fieldPackets = fieldPackets;
sourceField = HandlerTool.createField(this.fieldPackets.get(0));
Item select = itemSubQuery.getSelect();
select.setPushDownName(select.getAlias());
Item tmpItem = HandlerTool.createItem(select, Collections.singletonList(this.sourceField), 0, isAllPushDown(), type());
itemSubQuery.setFiled(tmpItem);
rowComparator = new RowDataComparator(this.fieldPackets, Collections.singletonList(new Order(select)), this.isAllPushDown(), this.type());
}
} finally {
lock.unlock();
}
}
use of com.actiontech.dble.backend.mysql.nio.handler.util.RowDataComparator in project dble by actiontech.
the class DistinctHandler method fieldEofResponse.
/**
* treat all the data from parent as Field Type
*/
public void fieldEofResponse(byte[] headerNull, List<byte[]> fieldsNull, final List<FieldPacket> fieldPackets, byte[] eofNull, boolean isLeft, BackendConnection conn) {
if (terminate.get())
return;
if (this.pool == null)
this.pool = DbleServer.getInstance().getBufferPool();
this.fieldPackets = fieldPackets;
List<Field> sourceFields = HandlerTool.createFields(this.fieldPackets);
if (this.distinctCols == null) {
// eg:show tables
this.distinctCols = new ArrayList<>();
for (FieldPacket fp : this.fieldPackets) {
Item sel = HandlerTool.createItemField(fp);
this.distinctCols.add(sel);
}
}
List<Order> orders = this.fixedOrders;
if (orders == null)
orders = HandlerTool.makeOrder(this.distinctCols);
RowDataComparator comparator = new RowDataComparator(this.fieldPackets, orders, this.isAllPushDown(), type());
localResult = new DistinctLocalResult(pool, sourceFields.size(), comparator, CharsetUtil.getJavaCharset(conn.getCharset().getResults())).setMemSizeController(session.getOtherBufferMC());
nextHandler.fieldEofResponse(null, null, this.fieldPackets, null, this.isLeft, conn);
}
use of com.actiontech.dble.backend.mysql.nio.handler.util.RowDataComparator in project dble by actiontech.
the class OrderByHandler method fieldEofResponse.
@Override
public void fieldEofResponse(byte[] headerNull, List<byte[]> fieldsNull, final List<FieldPacket> fieldPackets, byte[] eofNull, boolean isLeft, final BackendConnection conn) {
if (terminate.get())
return;
if (this.pool == null)
this.pool = DbleServer.getInstance().getBufferPool();
this.fieldPackets = fieldPackets;
RowDataComparator cmp = new RowDataComparator(this.fieldPackets, orders, isAllPushDown(), type());
localResult = new SortedLocalResult(pool, fieldPackets.size(), cmp, CharsetUtil.getJavaCharset(conn.getCharset().getResults())).setMemSizeController(session.getOrderBufferMC());
nextHandler.fieldEofResponse(null, null, fieldPackets, null, this.isLeft, conn);
startOwnThread(conn);
}
Aggregations