sunchao commented on a change in pull request #32039:
URL: https://github.com/apache/spark/pull/32039#discussion_r609965321



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
##########
@@ -250,10 +252,13 @@ case class OverwritePartitionsDynamicExec(
 
 case class WriteToDataSourceV2Exec(
     batchWrite: BatchWrite,
+    refreshCache: () => Unit,
     query: SparkPlan) extends V2TableWriteExec {
 
   override protected def run(): Seq[InternalRow] = {
-    writeWithV2(batchWrite)
+    val writtenRows = writeWithV2(batchWrite)
+    refreshCache()
+    writtenRows

Review comment:
       Yes that should work too and also will require fewer code changes. I 
went this way to be consistent with other V2 write commands. Also, in future we 
may introduce `DataStreamWriterV2` which could pass write node with 
`UnresolvedRelation` to analyzer and be converted to execution plan, and this 
approach may fit better in that case.
   
   
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to