This is an automated email from the ASF dual-hosted git repository.

sarutak pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 02913d5e5b74 [SPARK-55033][SQL][4.0] Fix stringArgs of DSv2 writing 
commands
02913d5e5b74 is described below

commit 02913d5e5b749d1ef5350d0d7fe901d1e1a487b2
Author: Cheng Pan <[email protected]>
AuthorDate: Tue Jan 20 03:36:27 2026 +0900

    [SPARK-55033][SQL][4.0] Fix stringArgs of DSv2 writing commands
    
    Backport #53794 to branch-4.0
    
    ### What changes were proposed in this pull request?
    
    Replace `val stringArgs` with `def stringArgs` in v2 writing commands, 
because each call of the method `stringArgs` should return a brand-new 
`Iterator`, otherwise, subsequent consumers will get an empty result.
    
    ### Why are the changes needed?
    
    Fix EXPLAIN / UI display.
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes, for example, without this fix, I found that some `AppendData` nodes in 
UI do not contain `Arguments: ...` where they should be, this patch makes them 
display correctly consistently.
    
    ### How was this patch tested?
    
    INSERT INTO an Iceberg table and check UI, before vs after.
    
    <img width="389" height="86" alt="image" 
src="https://github.com/user-attachments/assets/3bdb18e2-b605-497f-9431-ae416c340541";
 />
    
    <img width="844" height="110" alt="image" 
src="https://github.com/user-attachments/assets/4ed3ea3f-4fcd-4b93-a1fd-2714c3fead12";
 />
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #53856 from pan3793/SPARK-55033-4.0.
    
    Authored-by: Cheng Pan <[email protected]>
    Signed-off-by: Kousuke Saruta <[email protected]>
---
 .../org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala      | 4 ++--
 .../spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
index f5c8f08ce87b..94d69fa21795 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala
@@ -250,7 +250,7 @@ case class ReplaceData(
     write: Option[Write] = None) extends RowLevelWrite {
 
   override val isByName: Boolean = false
-  override val stringArgs: Iterator[Any] = Iterator(table, query, write)
+  override def stringArgs: Iterator[Any] = Iterator(table, query, write)
 
   override lazy val references: AttributeSet = query.outputSet
 
@@ -332,7 +332,7 @@ case class WriteDelta(
     write: Option[DeltaWrite] = None) extends RowLevelWrite {
 
   override val isByName: Boolean = false
-  override val stringArgs: Iterator[Any] = Iterator(table, query, write)
+  override def stringArgs: Iterator[Any] = Iterator(table, query, write)
 
   override lazy val references: AttributeSet = query.outputSet
 
diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
index 40ac3a1e6ee4..06cc72c01981 100644
--- 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
+++ 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
@@ -286,7 +286,7 @@ case class ReplaceDataExec(
     projections: ReplaceDataProjections,
     write: Write) extends V2ExistingTableWriteExec {
 
-  override val stringArgs: Iterator[Any] = Iterator(query, write)
+  override def stringArgs: Iterator[Any] = Iterator(query, write)
 
   override def writingTask: WritingSparkTask[_] = {
     projections match {
@@ -311,7 +311,7 @@ case class WriteDeltaExec(
     projections: WriteDeltaProjections,
     write: DeltaWrite) extends V2ExistingTableWriteExec {
 
-  override lazy val stringArgs: Iterator[Any] = Iterator(query, write)
+  override def stringArgs: Iterator[Any] = Iterator(query, write)
 
   override lazy val writingTask: WritingSparkTask[_] = {
     if (projections.metadataProjection.isDefined) {


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

Reply via email to