use of org.apache.drill.exec.physical.resultSet.impl.PushResultSetReaderImpl.BatchHolder in project drill by apache.
the class StreamingHttpConnection method sendData.
/**
* Called from query thread, specifically from the Screen operator,
* for each batch.
*/
@Override
public void sendData(RpcOutcomeListener<Ack> listener, QueryDataPackage data) {
VectorContainer batch = data.batch();
try {
if (batchCount == 0) {
batchHolder = new BatchHolder(batch);
reader = new PushResultSetReaderImpl(batchHolder);
startSignal.await();
}
batchHolder.newBatch();
RowSetReader batchReader = reader.start();
emitBatch(batchReader);
batchCount++;
} catch (IOException e) {
throw UserException.dataWriteError(e).addContext("Failed to send JSON results to the REST client").build(logger);
} catch (InterruptedException e) {
throw new DrillRuntimeException("Interrupted", e);
} finally {
batch.zeroVectors();
listener.success(Acks.OK, null);
}
}
Aggregations