Interface ExchangeSource
- All Superinterfaces:
AutoCloseable,Closeable
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSourceHandles(List<ExchangeSourceHandle> handles) Add moreExchangeSourceHandle's to be read by theExchangeSource.voidclose()longGet the total memory that needs to be reserved in the memory pool.Get metrics describing ExchangeSource.Returns a future that will be completed when the exchange source becomes unblocked.booleanOnce isFinished returns true,read()will never return a non-null resultvoidNotifyExchangeSourcethat no moreExchangeSourceHandle's will be added with theaddSourceHandles(List)method.io.airlift.slice.Sliceread()Gets the next chunk of data.voidCalled by the engine to provide information about what source task output must be included and what must be skipped.
-
Field Details
-
NOT_BLOCKED
-
-
Method Details
-
addSourceHandles
Add moreExchangeSourceHandle's to be read by theExchangeSource.- Parameters:
handles- list ofExchangeSourceHandle's describing what exchange data to read. The full list of handles is returned byExchangeSourceHandleSource. The coordinator decides what items from that list should be handled by what task and creates sub-lists that are further getting sent to a worker to be read. Thehandleslist may containExchangeSourceHandle's created by more than a singleExchange.
-
noMoreSourceHandles
void noMoreSourceHandles()NotifyExchangeSourcethat no moreExchangeSourceHandle's will be added with theaddSourceHandles(List)method. -
setOutputSelector
Called by the engine to provide information about what source task output must be included and what must be skipped.This method can be called multiple times and out of order. Only a newest version (see
ExchangeSourceOutputSelector.getVersion()) must be taken into account. Updates with an older version must be ignored.The information provided by the
ExchangeSourceOutputSelectoris incremental and decisions for some partitions could be missing. The implementation is free to speculate.The final selector is guaranteed to contain a decision for each source partition (see
ExchangeSourceOutputSelector.isFinal()). If decision is made for a given partition in some version the decision is guaranteed not to change in newer versions. -
isBlocked
CompletableFuture<Void> isBlocked()Returns a future that will be completed when the exchange source becomes unblocked. If the exchange source is not blocked, this method should returnNOT_BLOCKED -
isFinished
boolean isFinished()Once isFinished returns true,read()will never return a non-null result -
read
@Nullable io.airlift.slice.Slice read()Gets the next chunk of data. This method is allowed to return null.The engine will keep calling this method until
isFinished()returnstrue- Returns:
- data written to an exchange using
ExchangeSink.add(int, Slice). The slice is always returned as a whole as written (the exchange does not split and does not merge slices).
-
getMemoryUsage
long getMemoryUsage()Get the total memory that needs to be reserved in the memory pool. This memory should include any buffers, etc. that are used for reading data -
getMetrics
-
close
void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-