Search in sources :

Example 1 with RuntimeFilterWritable

use of org.apache.drill.exec.work.filter.RuntimeFilterWritable in project drill by apache.

the class FragmentContextImpl method closeNotConsumedRFWs.

private void closeNotConsumedRFWs() {
    for (RuntimeFilterWritable runtimeFilterWritable : rfIdentifier2RFW.values()) {
        long rfIdentifier = runtimeFilterWritable.getRuntimeFilterBDef().getRfIdentifier();
        boolean fetchedByOperator = rfIdentifier2fetched.get(rfIdentifier);
        if (!fetchedByOperator) {
            // if the RF hasn't been consumed by the operator, we have to released it one more time.
            runtimeFilterWritable.close();
        }
    }
}
Also used : RuntimeFilterWritable(org.apache.drill.exec.work.filter.RuntimeFilterWritable)

Example 2 with RuntimeFilterWritable

use of org.apache.drill.exec.work.filter.RuntimeFilterWritable 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();
    }
}
Also used : RuntimeFilterWritable(org.apache.drill.exec.work.filter.RuntimeFilterWritable) BitData(org.apache.drill.exec.proto.BitData) RpcException(org.apache.drill.exec.rpc.RpcException) IOException(java.io.IOException) FragmentSetupException(org.apache.drill.exec.exception.FragmentSetupException) DrillBuf(io.netty.buffer.DrillBuf)

Aggregations

RuntimeFilterWritable (org.apache.drill.exec.work.filter.RuntimeFilterWritable)2 DrillBuf (io.netty.buffer.DrillBuf)1 IOException (java.io.IOException)1 FragmentSetupException (org.apache.drill.exec.exception.FragmentSetupException)1 BitData (org.apache.drill.exec.proto.BitData)1 RpcException (org.apache.drill.exec.rpc.RpcException)1