Search in sources :

Example 1 with ThriftMethod

use of com.facebook.drift.annotations.ThriftMethod in project presto by prestodb.

the class ThriftTaskService method getResults.

@ThriftMethod
public ListenableFuture<ThriftBufferResult> getResults(TaskId taskId, OutputBufferId bufferId, long token, long maxSizeInBytes) {
    requireNonNull(taskId, "taskId is null");
    requireNonNull(bufferId, "bufferId is null");
    ListenableFuture<BufferResult> bufferResultFuture = taskManager.getTaskResults(taskId, bufferId, token, new DataSize(maxSizeInBytes, BYTE));
    Duration waitTime = randomizeWaitTime(DEFAULT_MAX_WAIT_TIME);
    bufferResultFuture = addTimeout(bufferResultFuture, () -> BufferResult.emptyResults(taskManager.getTaskInstanceId(taskId), token, false), waitTime, timeoutExecutor);
    return Futures.transform(bufferResultFuture, ThriftBufferResult::fromBufferResult, directExecutor());
}
Also used : ThriftBufferResult(com.facebook.presto.execution.buffer.ThriftBufferResult) BufferResult(com.facebook.presto.execution.buffer.BufferResult) DataSize(io.airlift.units.DataSize) Duration(io.airlift.units.Duration) ThriftBufferResult(com.facebook.presto.execution.buffer.ThriftBufferResult) ThriftMethod(com.facebook.drift.annotations.ThriftMethod)

Aggregations

ThriftMethod (com.facebook.drift.annotations.ThriftMethod)1 BufferResult (com.facebook.presto.execution.buffer.BufferResult)1 ThriftBufferResult (com.facebook.presto.execution.buffer.ThriftBufferResult)1 DataSize (io.airlift.units.DataSize)1 Duration (io.airlift.units.Duration)1