szehon-ho commented on code in PR #57402:
URL: https://github.com/apache/spark/pull/57402#discussion_r3660251009


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/RewriteMergeIntoTable.scala:
##########
@@ -74,7 +76,7 @@ object RewriteMergeIntoTable extends RewriteRowLevelCommand 
with PredicateHelper
           }
           val project = Project(projectList, joinPlan)
 
-          InsertOnlyMerge(r, project)
+          InsertOnlyMerge(r, project, output = operationTable.operationOutput)

Review Comment:
   For insert-only MERGE, the command **schema** comes from 
`RowLevelOperation.outputSchema()` here (`operationTable.operationOutput`), but 
the **rows** come from `Write.output()` on the `Write` built later via 
`table.newWriteBuilder()` in `V2Writes` — not from 
`RowLevelOperation.newWriteBuilder()`.
   
   A connector that only implements `outputSchema()` + `Write.output()` on the 
row-level Write will get a non-empty command schema but empty rows on this 
path. The in-memory table hides that because `InMemoryWriterBuilder` also 
overrides `Write.output()`.
   
   Should we document that both Write paths must implement matching `output()` 
/ `outputSchema()`?  Any other way to fix it?



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