Search in sources :

Example 56 with RpcException

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

RpcException (org.apache.drill.exec.rpc.RpcException)56 Test (org.junit.Test)22 ExecutionException (java.util.concurrent.ExecutionException)18 IOException (java.io.IOException)15 NonTransientRpcException (org.apache.drill.exec.rpc.NonTransientRpcException)12 Connection (java.sql.Connection)10 SQLException (java.sql.SQLException)10 JdbcTest (org.apache.drill.categories.JdbcTest)10 Response (org.apache.drill.exec.rpc.Response)9 Properties (java.util.Properties)8 SaslException (javax.security.sasl.SaslException)8 QueryId (org.apache.drill.exec.proto.UserBitShared.QueryId)8 UserException (org.apache.drill.common.exceptions.UserException)6 DrillBuf (io.netty.buffer.DrillBuf)5 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)4 ByteString (com.google.protobuf.ByteString)4 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)4 ByteBufInputStream (io.netty.buffer.ByteBufInputStream)4 DrillException (org.apache.drill.common.exceptions.DrillException)4 UserRemoteException (org.apache.drill.common.exceptions.UserRemoteException)4