Class PartitionTempFileManager


  • @Internal
    public class PartitionTempFileManager
    extends Object
    Manage temporary files for writing files. Use special rules to organize directories for temporary files.

    Temporary file directory contains the following directory parts: 1.temporary base path directory. 2.task id directory. 3.directories to specify partitioning. 4.data files. eg: /tmp/task-0-attempt-0/p0=1/p1=2/fileName.

    • Constructor Detail

      • PartitionTempFileManager

        public PartitionTempFileManager​(FileSystemFactory factory,
                                        org.apache.flink.core.fs.Path tmpPath,
                                        int taskNumber,
                                        int attemptNumber)
                                 throws IOException
        Throws:
        IOException
      • PartitionTempFileManager

        public PartitionTempFileManager​(FileSystemFactory factory,
                                        org.apache.flink.core.fs.Path tmpPath,
                                        int taskNumber,
                                        int attemptNumber,
                                        org.apache.flink.streaming.api.functions.sink.filesystem.OutputFileConfig outputFileConfig)
                                 throws IOException
        Throws:
        IOException
    • Method Detail

      • createPartitionDir

        public org.apache.flink.core.fs.Path createPartitionDir​(String... partitions)
        Generate a new partition directory with partitions.
      • listTaskTemporaryPaths

        public static List<org.apache.flink.core.fs.Path> listTaskTemporaryPaths​(org.apache.flink.core.fs.FileSystem fs,
                                                                                 org.apache.flink.core.fs.Path basePath,
                                                                                 BiPredicate<Integer,​Integer> taskAttemptFilter)
                                                                          throws Exception
        Returns task temporary paths in this checkpoint.
        Throws:
        Exception
      • collectPartSpecToPaths

        public static Map<LinkedHashMap<String,​String>,​List<org.apache.flink.core.fs.Path>> collectPartSpecToPaths​(org.apache.flink.core.fs.FileSystem fs,
                                                                                                                               List<org.apache.flink.core.fs.Path> taskPaths,
                                                                                                                               int partColSize)
        Collect all partitioned paths, aggregate according to partition spec.