use of org.apache.drill.exec.rpc.RpcException in project drill by apache.
the class DataServerRequestHandler method handleRuntimeFilterRequest.
private void handleRuntimeFilterRequest(ByteBuf pBody, ByteBuf dBody, ResponseSender sender) throws RpcException {
BitData.RuntimeFilterBDef runtimeFilterBDef = RpcBus.get(pBody, BitData.RuntimeFilterBDef.PARSER);
if (dBody == null) {
return;
}
List<Integer> bfSizeInBytes = runtimeFilterBDef.getBloomFilterSizeInBytesList();
int boomFilterNum = bfSizeInBytes.size();
DrillBuf data = (DrillBuf) dBody;
DrillBuf[] bufs = new DrillBuf[boomFilterNum];
int index = 0;
for (int i = 0; i < boomFilterNum; i++) {
int length = bfSizeInBytes.get(i);
bufs[i] = data.slice(index, length);
index = index + length;
}
RuntimeFilterWritable runtimeFilterWritable = new RuntimeFilterWritable(runtimeFilterBDef, bufs);
AckSender ackSender = new AckSender(sender);
ackSender.increment();
try {
// hand to WorkerBee to solve the received RuntimeFilter, the receiver maybe Foreman or a scan node.
bee.receiveRuntimeFilter(runtimeFilterWritable);
} catch (Exception e) {
logger.error("error to solve received runtime filter, {}", QueryIdHelper.getQueryId(runtimeFilterBDef.getQueryId()), e);
ackSender.clear();
ackSender.sendFail();
} finally {
ackSender.sendOk();
}
}
Aggregations