Class NonSerializedPartition<K>
- java.lang.Object
-
- org.apache.nemo.runtime.executor.data.partition.NonSerializedPartition<K>
-
- Type Parameters:
K
- the key type of its partitions.
- All Implemented Interfaces:
Partition<java.lang.Iterable,K>
public final class NonSerializedPartition<K> extends java.lang.Object implements Partition<java.lang.Iterable,K>
A collection of data elements. The data is stored as an iterable of elements. This is a unit of read / write towardsBlock
s.
-
-
Constructor Summary
Constructors Constructor Description NonSerializedPartition(K key)
Creates a non-serializedPartition
without actual data.NonSerializedPartition(K key, java.util.List data, long numSerializedBytes, long numEncodedBytes)
Creates a non-serializedPartition
with actual data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
commit()
Commits a partition to prevent further data write.java.lang.Iterable
getData()
K
getKey()
long
getNumEncodedBytes()
long
getNumSerializedBytes()
boolean
isSerialized()
void
write(java.lang.Object element)
Writes an element to non-committed partition.
-
-
-
Constructor Detail
-
NonSerializedPartition
public NonSerializedPartition(K key)
Creates a non-serializedPartition
without actual data. Data can be written to this partition until it is committed.- Parameters:
key
- the key of this partition.
-
NonSerializedPartition
public NonSerializedPartition(K key, java.util.List data, long numSerializedBytes, long numEncodedBytes)
Creates a non-serializedPartition
with actual data. Data cannot be written to this partition after the construction.- Parameters:
key
- the key.data
- the non-serialized data.numSerializedBytes
- the number of bytes in serialized form (which is, for example, encoded and compressed)numEncodedBytes
- the number of bytes in encoded form (which is ready to be decoded)
-
-
Method Detail
-
write
public void write(java.lang.Object element) throws java.io.IOException
Writes an element to non-committed partition.
-
commit
public void commit()
Commits a partition to prevent further data write.
-
getNumSerializedBytes
public long getNumSerializedBytes() throws DataUtil.IteratorWithNumBytes.NumBytesNotSupportedException
- Returns:
- the number of bytes in serialized form (which is, for example, encoded and compressed)
- Throws:
DataUtil.IteratorWithNumBytes.NumBytesNotSupportedException
- when then information is not available
-
getNumEncodedBytes
public long getNumEncodedBytes() throws DataUtil.IteratorWithNumBytes.NumBytesNotSupportedException
- Returns:
- the number of bytes in encoded form (which is ready to be decoded)
- Throws:
DataUtil.IteratorWithNumBytes.NumBytesNotSupportedException
- when then information is not available
-
getKey
public K getKey()
-
isSerialized
public boolean isSerialized()
- Specified by:
isSerialized
in interfacePartition<java.lang.Iterable,K>
- Returns:
- whether the data in this
Partition
is serialized or not.
-
-