aokolnychyi commented on code in PR #35395:
URL: https://github.com/apache/spark/pull/35395#discussion_r848737510


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2Writes.scala:
##########
@@ -85,12 +86,21 @@ object V2Writes extends Rule[LogicalPlan] with 
PredicateHelper {
     case WriteToMicroBatchDataSource(
         relation, table, query, queryId, writeOptions, outputMode, 
Some(batchId)) =>
 
-      val writeBuilder = newWriteBuilder(table, query, writeOptions, queryId)
+      val writeBuilder = newWriteBuilder(table, writeOptions, query.schema, 
queryId)
       val write = buildWriteForMicroBatch(table, writeBuilder, outputMode)
       val microBatchWrite = new MicroBatchWrite(batchId, write.toStreaming)
       val customMetrics = write.supportedCustomMetrics.toSeq
       val newQuery = DistributionAndOrderingUtils.prepareQuery(write, query, 
conf)
       WriteToDataSourceV2(relation, microBatchWrite, newQuery, customMetrics)
+
+    case rd @ ReplaceData(r: DataSourceV2Relation, _, query, _, None) =>
+      val rowSchema = StructType.fromAttributes(rd.dataInput)

Review Comment:
   We have to use `dataInput` as that one will have the correct nullability 
info for UPDATE and MERGE.



##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2Writes.scala:
##########
@@ -85,12 +86,21 @@ object V2Writes extends Rule[LogicalPlan] with 
PredicateHelper {
     case WriteToMicroBatchDataSource(
         relation, table, query, queryId, writeOptions, outputMode, 
Some(batchId)) =>
 
-      val writeBuilder = newWriteBuilder(table, query, writeOptions, queryId)
+      val writeBuilder = newWriteBuilder(table, writeOptions, query.schema, 
queryId)
       val write = buildWriteForMicroBatch(table, writeBuilder, outputMode)
       val microBatchWrite = new MicroBatchWrite(batchId, write.toStreaming)
       val customMetrics = write.supportedCustomMetrics.toSeq
       val newQuery = DistributionAndOrderingUtils.prepareQuery(write, query, 
conf)
       WriteToDataSourceV2(relation, microBatchWrite, newQuery, customMetrics)
+
+    case rd @ ReplaceData(r: DataSourceV2Relation, _, query, _, None) =>
+      val rowSchema = StructType.fromAttributes(rd.dataInput)

Review Comment:
   We have to use `dataInput` as it will hold the correct nullability info for 
UPDATE and MERGE.



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