use of com.actiontech.dble.plan.common.exception.TempTableException 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.plan.common.exception.TempTableException in project dble by actiontech.
the class TempTableHandler method rowEofResponse.
@Override
public void rowEofResponse(byte[] eof, boolean isLeft, BackendConnection conn) {
lock.lock();
try {
// callBack after terminated
if (terminate.get()) {
return;
}
tempTable.dataEof();
// locked onTerminate, because terminated may sync with start
tempDoneCallBack.call();
RowDataPacket rp = null;
while ((rp = tempTable.nextRow()) != null) {
nextHandler.rowResponse(null, rp, this.isLeft, conn);
}
nextHandler.rowEofResponse(eof, this.isLeft, conn);
} catch (Exception e) {
LOGGER.info("rowEof exception!", e);
throw new TempTableException("rowEof exception!", e);
} finally {
lock.unlock();
}
}
use of com.actiontech.dble.plan.common.exception.TempTableException in project dble by actiontech.
the class TempTableHandler method rowResponse.
@Override
public boolean rowResponse(byte[] rowNull, RowDataPacket rowPacket, boolean isLeft, BackendConnection conn) {
lock.lock();
try {
if (terminate.get()) {
return true;
}
if (++rowCount > maxPartSize * maxConnSize) {
String errMessage = "temptable of [" + conn.toString() + "] too much rows,[rows=" + rowCount + "]!";
LOGGER.info(errMessage);
throw new TempTableException(errMessage);
}
RowDataPacket row = rowPacket;
if (row == null) {
row = new RowDataPacket(this.fieldPackets.size());
row.read(rowNull);
}
tempTable.addRow(row);
sourceField.setPtr(row.getValue(sourceSelIndex));
valueSet.add(sourceField.valStr());
} finally {
lock.unlock();
}
return false;
}
Aggregations