edrevo commented on a change in pull request #25990: [SPARK-29248][SQL] Pass in 
number of partitions to WriteBuilder
URL: https://github.com/apache/spark/pull/25990#discussion_r330086618
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
 ##########
 @@ -332,21 +336,37 @@ case class WriteToDataSourceV2Exec(
 trait BatchWriteHelper {
   def table: SupportsWrite
   def query: SparkPlan
+  def rdd: RDD[InternalRow]
   def writeOptions: CaseInsensitiveStringMap
 
   def newWriteBuilder(): WriteBuilder = {
-    table.newWriteBuilder(writeOptions)
-      .withInputDataSchema(query.schema)
-      .withQueryId(UUID.randomUUID().toString)
+    val writeInfo = WriteInfoImpl(
+      queryId = UUID.randomUUID().toString,
+      query.schema,
+      rdd.getNumPartitions)
+    table.newWriteBuilder(writeOptions, writeInfo)
+  }
+}
+
+trait WriteBase { this: SparkPlan =>
 
 Review comment:
   There's probably a better name for this trait. I'm happy to change 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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to