Class SerdeUtils


  • @Internal
    public class SerdeUtils
    extends Object
    A util class with some helper method for serde in the sources.
    • Method Detail

      • serializeSplitAssignments

        public static <SplitT extends SourceSplit,​C extends Collection<SplitT>> byte[] serializeSplitAssignments​(Map<Integer,​C> splitAssignments,
                                                                                                                       SimpleVersionedSerializer<SplitT> splitSerializer)
                                                                                                                throws IOException
        Serialize a mapping from subtask ids to lists of assigned splits. The serialized format is following:
         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
         
        Type Parameters:
        SplitT - the type of the splits.
        C - the type of the collection to hold the assigned splits for a subtask.
        Parameters:
        splitAssignments - a mapping from subtask ids to lists of assigned splits.
        splitSerializer - the serializer of the split.
        Returns:
        the serialized bytes of the given subtask to splits assignment mapping.
        Throws:
        IOException - when serialization failed.