public class SerdeUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <SplitT extends SourceSplit,C extends Collection<SplitT>> |
deserializeSplitAssignments(byte[] serialized,
SimpleVersionedSerializer<SplitT> splitSerializer,
java.util.function.Function<Integer,C> collectionSupplier)
Deserialize the given bytes returned by
serializeSplitAssignments(Map,
SimpleVersionedSerializer) . |
static <SplitT extends SourceSplit,C extends Collection<SplitT>> |
serializeSplitAssignments(Map<Integer,C> splitAssignments,
SimpleVersionedSerializer<SplitT> splitSerializer)
Serialize a mapping from subtask ids to lists of assigned splits.
|
public static <SplitT extends SourceSplit,C extends Collection<SplitT>> byte[] serializeSplitAssignments(Map<Integer,C> splitAssignments, SimpleVersionedSerializer<SplitT> splitSerializer) throws IOException
4 bytes - number of subtasks 4 bytes - split serializer version N bytes - [assignment_for_subtask] 4 bytes - subtask id 4 bytes - number of assigned splits N bytes - [assigned_splits] 4 bytes - serialized split length N bytes - serialized splits
SplitT
- the type of the splits.C
- the type of the collection to hold the assigned splits for a subtask.splitAssignments
- a mapping from subtask ids to lists of assigned splits.splitSerializer
- the serializer of the split.IOException
- when serialization failed.public static <SplitT extends SourceSplit,C extends Collection<SplitT>> Map<Integer,C> deserializeSplitAssignments(byte[] serialized, SimpleVersionedSerializer<SplitT> splitSerializer, java.util.function.Function<Integer,C> collectionSupplier) throws IOException
serializeSplitAssignments(Map,
SimpleVersionedSerializer)
.SplitT
- the type of the splits.C
- the type of the collection to hold the assigned splits for a subtask.serialized
- the serialized bytes returned by serializeSplitAssignments(Map,
SimpleVersionedSerializer)
.splitSerializer
- the split serializer for the splits.collectionSupplier
- the supplier for the Collection
instance to hold the
assigned splits for a subtask.IOException
- when deserialization failed.Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.