public class ContinuousHiveSplitEnumerator<T extends Comparable<T>> extends Object implements SplitEnumerator<HiveSourceSplit,PendingSplitsCheckpoint<HiveSourceSplit>>
SplitEnumerator
for hive source.Constructor and Description |
---|
ContinuousHiveSplitEnumerator(SplitEnumeratorContext<HiveSourceSplit> enumeratorContext,
T currentReadOffset,
Collection<List<String>> seenPartitionsSinceOffset,
FileSplitAssigner splitAssigner,
long discoveryInterval,
org.apache.hadoop.mapred.JobConf jobConf,
ObjectPath tablePath,
ContinuousPartitionFetcher<org.apache.hadoop.hive.metastore.api.Partition,T> fetcher,
HiveTableSource.HiveContinuousPartitionFetcherContext<T> fetcherContext) |
Modifier and Type | Method and Description |
---|---|
void |
addReader(int subtaskId)
Add a new source reader with the given subtask ID.
|
void |
addSplitsBack(List<HiveSourceSplit> splits,
int subtaskId)
Add a split back to the split enumerator.
|
void |
close()
Called to close the enumerator, in case it holds on to any resources, like threads or network
connections.
|
void |
handleSourceEvent(int subtaskId,
SourceEvent sourceEvent)
Handles a custom source event from the source reader.
|
void |
handleSplitRequest(int subtaskId,
String hostName)
Handles the request for a split.
|
PendingSplitsCheckpoint<HiveSourceSplit> |
snapshotState()
Checkpoints the state of this split enumerator.
|
void |
start()
Start the split enumerator.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
notifyCheckpointComplete
notifyCheckpointAborted
public ContinuousHiveSplitEnumerator(SplitEnumeratorContext<HiveSourceSplit> enumeratorContext, T currentReadOffset, Collection<List<String>> seenPartitionsSinceOffset, FileSplitAssigner splitAssigner, long discoveryInterval, org.apache.hadoop.mapred.JobConf jobConf, ObjectPath tablePath, ContinuousPartitionFetcher<org.apache.hadoop.hive.metastore.api.Partition,T> fetcher, HiveTableSource.HiveContinuousPartitionFetcherContext<T> fetcherContext)
public void start()
SplitEnumerator
The default behavior does nothing.
start
in interface SplitEnumerator<HiveSourceSplit,PendingSplitsCheckpoint<HiveSourceSplit>>
public void handleSplitRequest(int subtaskId, @Nullable String hostName)
SplitEnumerator
SourceReaderContext.sendSplitRequest()
method.handleSplitRequest
in interface SplitEnumerator<HiveSourceSplit,PendingSplitsCheckpoint<HiveSourceSplit>>
subtaskId
- the subtask id of the source reader who sent the source event.hostName
- Optional, the hostname where the requesting task is running. This
can be used to make split assignments locality-aware.public void handleSourceEvent(int subtaskId, SourceEvent sourceEvent)
SplitEnumerator
This method has a default implementation that does nothing, because it is only required to
be implemented by some sources, which have a custom event protocol between reader and
enumerator. The common events for reader registration and split requests are not dispatched
to this method, but rather invoke the SplitEnumerator.addReader(int)
and SplitEnumerator.handleSplitRequest(int, String)
methods.
handleSourceEvent
in interface SplitEnumerator<HiveSourceSplit,PendingSplitsCheckpoint<HiveSourceSplit>>
subtaskId
- the subtask id of the source reader who sent the source event.sourceEvent
- the source event from the source reader.public void addSplitsBack(List<HiveSourceSplit> splits, int subtaskId)
SplitEnumerator
SourceReader
fails and there are splits assigned to it after the last successful checkpoint.addSplitsBack
in interface SplitEnumerator<HiveSourceSplit,PendingSplitsCheckpoint<HiveSourceSplit>>
splits
- The split to add back to the enumerator for reassignment.subtaskId
- The id of the subtask to which the returned splits belong.public void addReader(int subtaskId)
SplitEnumerator
addReader
in interface SplitEnumerator<HiveSourceSplit,PendingSplitsCheckpoint<HiveSourceSplit>>
subtaskId
- the subtask ID of the new source reader.public PendingSplitsCheckpoint<HiveSourceSplit> snapshotState() throws Exception
SplitEnumerator
snapshotState
in interface SplitEnumerator<HiveSourceSplit,PendingSplitsCheckpoint<HiveSourceSplit>>
Exception
- when the snapshot cannot be taken.public void close() throws IOException
SplitEnumerator
close
in interface AutoCloseable
close
in interface SplitEnumerator<HiveSourceSplit,PendingSplitsCheckpoint<HiveSourceSplit>>
IOException
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.