Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22721#discussion_r226208576
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/InsertIntoHadoopFsRelationCommand.scala
 ---
    @@ -189,6 +189,7 @@ case class InsertIntoHadoopFsRelationCommand(
           sparkSession.catalog.refreshByPath(outputPath.toString)
     
           if (catalogTable.nonEmpty) {
    +        
sparkSession.catalog.refreshTable(catalogTable.get.identifier.quotedString)
    --- End diff --
    
    shall we do
    ```
    if (catalogTable.isDefined) {
      
sparkSession.catalog.refreshTable(catalogTable.get.identifier.quotedString)
    } else {
      // refresh cached files in FileIndex
           fileIndex.foreach(_.refresh())
           // refresh data cache if table is cached
          sparkSession.catalog.refreshByPath(outputPath.toString)
    }
    ```


---

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

Reply via email to