Package org.datavec.api.split.partition
Class NumberOfRecordsPartitioner
- java.lang.Object
-
- org.datavec.api.split.partition.NumberOfRecordsPartitioner
-
- All Implemented Interfaces:
Partitioner
public class NumberOfRecordsPartitioner extends Object implements Partitioner
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_RECORDS_PER_FILEstatic StringRECORDS_PER_FILE_CONFIG
-
Constructor Summary
Constructors Constructor Description NumberOfRecordsPartitioner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OutputStreamcurrentOutputStream()Get the current output streamvoidinit(Configuration configuration, InputSplit split)Initializes this partitioner with the given configuration and input splitvoidinit(InputSplit inputSplit)Initializes this partitioner with the given configuration and input splitbooleanneedsNewPartition()Returns true if the partition needs to be moved to the next.intnumPartitions()Returns the number of partitionsintnumRecordsWritten()Number of records written so farOutputStreamopenNewStream()"Increment" to the next streaminttotalRecordsWritten()Returns the total records writtenvoidupdatePartitionInfo(PartitionMetaData metadata)Updates the metadata for this partitioner (to indicate whether the next partition is needed or not)
-
-
-
Field Detail
-
DEFAULT_RECORDS_PER_FILE
public static final int DEFAULT_RECORDS_PER_FILE
- See Also:
- Constant Field Values
-
RECORDS_PER_FILE_CONFIG
public static final String RECORDS_PER_FILE_CONFIG
- See Also:
- Constant Field Values
-
-
Method Detail
-
totalRecordsWritten
public int totalRecordsWritten()
Description copied from interface:PartitionerReturns the total records written- Specified by:
totalRecordsWrittenin interfacePartitioner- Returns:
-
numRecordsWritten
public int numRecordsWritten()
Description copied from interface:PartitionerNumber of records written so far- Specified by:
numRecordsWrittenin interfacePartitioner- Returns:
-
numPartitions
public int numPartitions()
Description copied from interface:PartitionerReturns the number of partitions- Specified by:
numPartitionsin interfacePartitioner- Returns:
-
init
public void init(InputSplit inputSplit)
Description copied from interface:PartitionerInitializes this partitioner with the given configuration and input split- Specified by:
initin interfacePartitioner- Parameters:
inputSplit- the input split to use with this partitioner
-
init
public void init(Configuration configuration, InputSplit split)
Description copied from interface:PartitionerInitializes this partitioner with the given configuration and input split- Specified by:
initin interfacePartitioner- Parameters:
configuration- the configuration to configure this partitioner withsplit- the input split to use with this partitioner
-
updatePartitionInfo
public void updatePartitionInfo(PartitionMetaData metadata)
Description copied from interface:PartitionerUpdates the metadata for this partitioner (to indicate whether the next partition is needed or not)- Specified by:
updatePartitionInfoin interfacePartitioner
-
needsNewPartition
public boolean needsNewPartition()
Description copied from interface:PartitionerReturns true if the partition needs to be moved to the next. This is controlled withPartitioner.updatePartitionInfo(PartitionMetaData)which handles incrementing counters and the like to determine whether the current partition has been exhausted.- Specified by:
needsNewPartitionin interfacePartitioner- Returns:
-
openNewStream
public OutputStream openNewStream()
Description copied from interface:Partitioner"Increment" to the next stream- Specified by:
openNewStreamin interfacePartitioner- Returns:
- the new opened output stream
-
currentOutputStream
public OutputStream currentOutputStream()
Description copied from interface:PartitionerGet the current output stream- Specified by:
currentOutputStreamin interfacePartitioner- Returns:
-
-