public interface Partitioner
RecordWriter.
This allows for a configurable log rotation like algorithm for partitioning files by number of recodrds,
sizes among other things.| Modifier and Type | Method and Description |
|---|---|
OutputStream |
currentOutputStream()
Get the current output stream
|
void |
init(Configuration configuration,
InputSplit split)
Initializes this partitioner with the given configuration
and input split
|
void |
init(InputSplit inputSplit)
Initializes this partitioner with the given configuration
and input split
|
boolean |
needsNewPartition()
Returns true if the partition needs to be moved to the next.
|
int |
numPartitions()
Returns the number of partitions
|
int |
numRecordsWritten()
Number of records written so far
|
OutputStream |
openNewStream()
"Increment" to the next stream
|
int |
totalRecordsWritten()
Returns the total records written
|
void |
updatePartitionInfo(PartitionMetaData metadata)
Updates the metadata for this partitioner
(to indicate whether the next partition is needed or not)
|
int totalRecordsWritten()
int numRecordsWritten()
int numPartitions()
void init(InputSplit inputSplit)
inputSplit - the input split to use with this partitionervoid init(Configuration configuration, InputSplit split)
configuration - the configuration to configure
this partitioner withsplit - the input split to use with this partitionervoid updatePartitionInfo(PartitionMetaData metadata)
metadata - boolean needsNewPartition()
updatePartitionInfo(PartitionMetaData)
which handles incrementing counters and the like
to determine whether the current partition has been exhausted.OutputStream openNewStream()
OutputStream currentOutputStream()
Copyright © 2020. All rights reserved.