Class PartitionedFileWriter

    • Constructor Detail

      • PartitionedFileWriter

        public PartitionedFileWriter​(int numSubpartitions,
                                     int maxIndexBufferSize,
                                     String basePath)
                              throws IOException
        Throws:
        IOException
    • Method Detail

      • startNewRegion

        public void startNewRegion​(boolean isBroadcastRegion)
                            throws IOException
        Persists the region index of the current data region and starts a new region to write.

        Note: The caller is responsible for releasing the failed PartitionedFile if any exception occurs.

        Parameters:
        isBroadcastRegion - Whether it's a broadcast region. See isBroadcastRegion.
        Throws:
        IOException
      • writeBuffers

        public void writeBuffers​(List<BufferWithSubpartition> bufferWithSubpartitions)
                          throws IOException
        Writes a list of Buffers to this PartitionedFile. It guarantees that after the return of this method, the target buffers can be released. In a data region, all data of the same subpartition must be written together.

        Note: The caller is responsible for recycling the target buffers and releasing the failed PartitionedFile if any exception occurs.

        Throws:
        IOException
      • releaseQuietly

        public void releaseQuietly()
        Used to close and delete the failed PartitionedFile when any exception occurs.