Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2576#discussion_r18766443
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/parquet/ParquetTableOperations.scala
 ---
    @@ -504,19 +505,41 @@ private[parquet] object FileSystemHelper {
         fs.listStatus(path).map(_.getPath)
       }
     
    -    /**
    -     * Finds the maximum taskid in the output file names at the given path.
    -     */
    -  def findMaxTaskId(pathStr: String, conf: Configuration): Int = {
    +  /**
    +   *  List files with special extension
    +   */
    +  def listFiles(origPath: Path, conf: Configuration, extension: String): 
Seq[Path] = {
    +    val fs = origPath.getFileSystem(conf)
    +    if (fs == null) {
    +      throw new IllegalArgumentException(
    +        s"OrcTableOperations: Path $origPath is incorrectly formatted")
    +    }
    +    val path = origPath.makeQualified(fs)
    +    if (fs.exists(path) && fs.getFileStatus(path).isDir) {
    +      fs.listStatus(path).map(_.getPath).filter(p => 
p.getName.endsWith(extension))
    --- End diff --
    
    I think `FileSystem.globStatus` can be convenient and more efficient here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to