dongjoon-hyun commented on code in PR #60731:
URL: https://github.com/apache/spark/pull/60731#discussion_r4644772990


##########
sql/core/src/main/scala/org/apache/spark/sql/classic/DataFrameWriterV2.scala:
##########
@@ -55,7 +55,9 @@ final class DataFrameWriterV2[T] private[sql](table: String, 
ds: Dataset[T])
 
   private val tableName = 
sparkSession.sessionState.sqlParser.parseMultipartIdentifier(table)
 
-  private val logicalPlan = df.queryExecution.logical
+  // Use the analyzed plan like `DataFrameWriter`. Re-analyzing an unanalyzed 
plan resolves the
+  // write output before `UpdateAttributeNullability` updates the stale 
nullability of the query.
+  private val logicalPlan = df.logicalPlan

Review Comment:
   Thank you, @peter-toth. You're right. I confirmed that master writes `10, 
11` when the DataFrame is created directly by `spark.table("v")` or 
`spark.sql("SELECT * FROM v")`, while `spark.table("v").select("id")` already 
writes `0, 1, 2` on master, like `collect()` and `DataFrameWriter.insertInto`. 
I updated the user-facing section of the PR description with your example, next 
to the dropped and re-added column.
   



-- 
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.

To unsubscribe, e-mail: [email protected]

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