class PaloFile extends File {

    private static final long serialVersionUID = -1918775445693598353L;

    public PaloFile(String dir, String subDir, String fileName) {
        this(Paths.get(dir, subDir, fileName).toString());
    }

    public PaloFile(String path, int id, int part) {
        this(Paths.get(path, formatFileName(id, part)).toString());
    }

    public PaloFile(String path) {
        super(path);
    }

    public String table() {
        return this.getParentFile().getName();
    }

    public int sessionId() {
        String[] parts = this.getName().split("-");
        E.checkState(parts.length == 2,
                     "Invalid file name format '%s' for palo temp file, " +
                     "the legal format is session{m}-part{n}", this.getName());
        return Integer.parseInt(parts[0].substring("session".length()));
    }

    public int sessionPart() {
        String[] parts = this.getName().split("-");
        E.checkState(parts.length == 2,
                     "Invalid file name format '%s' for palo temp file, " +
                     "the legal format is session{m}-part{n}", this.getName());
        return Integer.parseInt(parts[1].substring("part".length()));
    }

    public int writeLines(Collection<String> lines) {
        try {
            FileUtils.writeLines(this, Charsets.UTF_8.name(), lines, true);
        } catch (IOException e) {
            throw new BackendException(e);
        }
        return lines.size();
    }

    public String readAsString() {
        try {
            return FileUtils.readFileToString(this);
        } catch (IOException e) {
            throw new BackendException(e);
        }
    }

    public void forceDelete() {
        if (this.exists()) {
            try {
                FileUtils.forceDelete(this);
            } catch (IOException e) {
                throw new BackendException(e);
            }
        }
    }

    public static void clearDir(String tempDir) {
        File file = FileUtils.getFile(tempDir);
        if (!file.exists()) {
            return;
        }
        try {
            FileUtils.forceDelete(file);
        } catch (IOException e) {
            throw new BackendException(e);
        }
    }

    public static List<PaloFile> scan(String path, List<String> tableDirs) {<FILL_FUNCTION_BODY>}

    private static String formatFileName(int id, int part) {
        return String.format("session%s-part%s", id, part);
    }

    private static int[] parseFileName(String fileName) {
        String[] nameParts = fileName.split("-");
        E.checkArgument(nameParts.length == 2,
                        "Invalid file name format '%s' for palo temp file, " +
                        "the legal format is session{m}-part{n}", fileName);
        int[] rs = new int[2];
        rs[0] = Integer.parseInt(nameParts[0].substring("session".length()));
        rs[1] = Integer.parseInt(nameParts[1].substring("part".length()));
        return rs;
    }

    public static long limitSize(HugeConfig config) {
        long limitSize = config.get(PaloOptions.PALO_FILE_LIMIT_SIZE);
        return limitSize * 1024 * 1024;
    }

    public static Set<Integer> scanSessionIds(HugeConfig config,
                                              List<String> tableDirs) {
        Set<Integer> sessionIds = new HashSet<>();

        String path = config.get(PaloOptions.PALO_TEMP_DIR);
        File pathDir = Paths.get(path).toFile();
        if (!pathDir.exists()) {
            return sessionIds;
        }
        for (String table : tableDirs) {
            File tableDir = Paths.get(path, table).toFile();
            if (!tableDir.exists()) {
                continue;
            }
            String[] fileNames = tableDir.list();
            if (fileNames == null || fileNames.length == 0) {
                continue;
            }
            for (String fileName : fileNames) {
                int[] parts = PaloFile.parseFileName(fileName);
                int sessionId = parts[0];
                sessionIds.add(sessionId);
            }
        }
        return sessionIds;
    }
}

        File directory = FileUtils.getFile(path);
        if (!directory.exists()) {
            return ImmutableList.of();
        }

        File[] subDirs = directory.listFiles((dir, name) -> {
            return tableDirs.contains(name);
        });
        if (subDirs == null || subDirs.length == 0) {
            return ImmutableList.of();
        }

        List<PaloFile> paloFiles = new ArrayList<>(subDirs.length);
        for (File subDir : subDirs) {
            String[] fileNames = subDir.list();
            if (fileNames == null) {
                continue;
            }
            for (String fileName : fileNames) {
                paloFiles.add(new PaloFile(path, subDir.getName(), fileName));
            }
        }

        /*
         * Sort palo file by updated time in asc order,
         * let old files to be processed in priority
         */
        paloFiles.sort((file1, file2) -> {
            return (int) (file1.lastModified() - file2.lastModified());
        });
        return paloFiles;
    
<methods>public void <init>(java.lang.String) ,public void <init>(java.net.URI) ,public void <init>(java.lang.String, java.lang.String) ,public void <init>(java.io.File, java.lang.String) ,public boolean canExecute() ,public boolean canRead() ,public boolean canWrite() ,public int compareTo(java.io.File) ,public boolean createNewFile() throws java.io.IOException,public static java.io.File createTempFile(java.lang.String, java.lang.String) throws java.io.IOException,public static java.io.File createTempFile(java.lang.String, java.lang.String, java.io.File) throws java.io.IOException,public boolean delete() ,public void deleteOnExit() ,public boolean equals(java.lang.Object) ,public boolean exists() ,public java.io.File getAbsoluteFile() ,public java.lang.String getAbsolutePath() ,public java.io.File getCanonicalFile() throws java.io.IOException,public java.lang.String getCanonicalPath() throws java.io.IOException,public long getFreeSpace() ,public java.lang.String getName() ,public java.lang.String getParent() ,public java.io.File getParentFile() ,public java.lang.String getPath() ,public long getTotalSpace() ,public long getUsableSpace() ,public int hashCode() ,public boolean isAbsolute() ,public boolean isDirectory() ,public boolean isFile() ,public boolean isHidden() ,public long lastModified() ,public long length() ,public java.lang.String[] list() ,public java.lang.String[] list(java.io.FilenameFilter) ,public java.io.File[] listFiles() ,public java.io.File[] listFiles(java.io.FilenameFilter) ,public java.io.File[] listFiles(java.io.FileFilter) ,public static java.io.File[] listRoots() ,public boolean mkdir() ,public boolean mkdirs() ,public boolean renameTo(java.io.File) ,public boolean setExecutable(boolean) ,public boolean setExecutable(boolean, boolean) ,public boolean setLastModified(long) ,public boolean setReadOnly() ,public boolean setReadable(boolean) ,public boolean setReadable(boolean, boolean) ,public boolean setWritable(boolean) ,public boolean setWritable(boolean, boolean) ,public java.nio.file.Path toPath() ,public java.lang.String toString() ,public java.net.URI toURI() ,public java.net.URL toURL() throws java.net.MalformedURLException<variables>static final boolean $assertionsDisabled,private static final long PATH_OFFSET,private static final long PREFIX_LENGTH_OFFSET,private static final jdk.internal.misc.Unsafe UNSAFE,private volatile transient java.nio.file.Path filePath,private static final java.io.FileSystem fs,private final java.lang.String path,public static final java.lang.String pathSeparator,public static final char pathSeparatorChar,private final transient int prefixLength,public static final java.lang.String separator,public static final char separatorChar,private static final long serialVersionUID,private transient java.io.File.PathStatus status