use of io.trino.split.RemoteSplit in project trino by trinodb.
the class MergeOperator method addSplit.
@Override
public Supplier<Optional<UpdatablePageSource>> addSplit(Split split) {
requireNonNull(split, "split is null");
checkArgument(split.getConnectorSplit() instanceof RemoteSplit, "split is not a remote split");
checkState(!blockedOnSplits.isDone(), "noMoreSplits has been called already");
TaskContext taskContext = operatorContext.getDriverContext().getPipelineContext().getTaskContext();
DirectExchangeClient client = closer.register(directExchangeClientSupplier.get(taskContext.getTaskId().getQueryId(), new ExchangeId(format("direct-exchange-merge-%s-%s", taskContext.getTaskId().getStageId().getId(), sourceId)), operatorContext.localUserMemoryContext(), taskContext::sourceTaskFailed, RetryPolicy.NONE));
RemoteSplit remoteSplit = (RemoteSplit) split.getConnectorSplit();
// Only fault tolerant execution mode is expected to execute external exchanges.
// MergeOperator is used for distributed sort only and it is not compatible (and disabled) with fault tolerant execution mode.
DirectExchangeInput exchangeInput = (DirectExchangeInput) remoteSplit.getExchangeInput();
client.addLocation(exchangeInput.getTaskId(), URI.create(exchangeInput.getLocation()));
client.noMoreLocations();
pageProducers.add(client.pages().map(serializedPage -> {
Page page = pagesSerde.deserialize(serializedPage);
operatorContext.recordNetworkInput(serializedPage.length(), page.getPositionCount());
return page;
}));
return Optional::empty;
}
use of io.trino.split.RemoteSplit in project trino by trinodb.
the class PipelinedStageExecution method createExchangeSplit.
private static Split createExchangeSplit(RemoteTask sourceTask, RemoteTask destinationTask) {
// Fetch the results from the buffer assigned to the task based on id
URI exchangeLocation = sourceTask.getTaskStatus().getSelf();
URI splitLocation = uriBuilderFrom(exchangeLocation).appendPath("results").appendPath(String.valueOf(destinationTask.getTaskId().getPartitionId())).build();
return new Split(REMOTE_CONNECTOR_ID, new RemoteSplit(new DirectExchangeInput(sourceTask.getTaskId(), splitLocation.toString())), Lifespan.taskWide());
}
Aggregations