@PublicEvolving public class LocalityAwareSplitAssigner extends Object implements FileSplitAssigner
FileSplitAssigner that assigns to each host preferably splits that are local,
before assigning splits that are not local.
Implementation Note: This class is an adjusted copy of the previous API's class
LocatableInputSplitAssigner and reproduces the same assignment
logic, for compatibility. The logic has not been changed or optimized.
FileSplitAssigner.Provider| Constructor and Description |
|---|
LocalityAwareSplitAssigner(Collection<FileSourceSplit> splits) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSplits(Collection<FileSourceSplit> splits)
Adds a set of splits to this assigner.
|
Optional<FileSourceSplit> |
getNext(String host)
Gets the next split.
|
Collection<FileSourceSplit> |
remainingSplits()
Gets the remaining splits that this assigner has pending.
|
public LocalityAwareSplitAssigner(Collection<FileSourceSplit> splits)
public Optional<FileSourceSplit> getNext(@Nullable String host)
FileSplitAssignerWhen this method returns an empty Optional, then the set of splits is
assumed to be done and the source will finish once the readers finished their current
splits.
getNext in interface FileSplitAssignerpublic void addSplits(Collection<FileSourceSplit> splits)
FileSplitAssigneraddSplits in interface FileSplitAssignerpublic Collection<FileSourceSplit> remainingSplits()
FileSplitAssignerremainingSplits in interface FileSplitAssignerCopyright © 2014–2020 The Apache Software Foundation. All rights reserved.