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

    https://github.com/apache/spark/pull/13987#discussion_r69067474
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/ListingFileCatalog.scala
 ---
    @@ -58,10 +56,16 @@ class ListingFileCatalog(
       }
     
       override protected def leafFiles: mutable.LinkedHashMap[Path, 
FileStatus] = {
    +    if (cachedLeafFiles eq null) {
    +      refresh()
    +    }
         cachedLeafFiles
       }
     
       override protected def leafDirToChildrenFiles: Map[Path, 
Array[FileStatus]] = {
    +    if (cachedLeafDirToChildrenFiles eq null) {
    +      refresh()
    --- End diff --
    
    There is a side effect. `refresh()` rest the `cachedPartitionSpec` to null, 
which may cleared already inferred partition information. 
    
    ```
      override def refresh(): Unit = {
        val files = listLeafFiles(paths)
        cachedLeafFiles =
          new mutable.LinkedHashMap[Path, FileStatus]() ++= files.map(f => 
f.getPath -> f)
        cachedLeafDirToChildrenFiles = 
files.toArray.groupBy(_.getPath.getParent)
        cachedPartitionSpec = null
      }
    ```


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to