@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)
FileSplitAssigner
When 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 FileSplitAssigner
public void addSplits(Collection<FileSourceSplit> splits)
FileSplitAssigner
addSplits
in interface FileSplitAssigner
public Collection<FileSourceSplit> remainingSplits()
FileSplitAssigner
remainingSplits
in interface FileSplitAssigner
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.