aokolnychyi commented on a change in pull request #30806:
URL: https://github.com/apache/spark/pull/30806#discussion_r545371602



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
##########
@@ -477,9 +450,10 @@ private[v2] trait TableWriteExecHelper extends 
V2TableWriteExec with SupportsV1W
             writeOptions)
           val writeBuilder = table.newWriteBuilder(info)
 
-          val writtenRows = writeBuilder match {
-            case v1: V1WriteBuilder => writeWithV1(v1.buildForV1Write())
-            case v2 => writeWithV2(v2.buildForBatch())
+          val write = writeBuilder.build()
+          val writtenRows = write match {

Review comment:
       I don't feel strongly about this place and can update it. However, I do 
prefer to split different logical parts into different variables. Here, I've 
separated building a logical write from actually writing the records. Let me 
know what are you thoughts, @jzhuge.

##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala
##########
@@ -477,9 +450,10 @@ private[v2] trait TableWriteExecHelper extends 
V2TableWriteExec with SupportsV1W
             writeOptions)
           val writeBuilder = table.newWriteBuilder(info)
 
-          val writtenRows = writeBuilder match {
-            case v1: V1WriteBuilder => writeWithV1(v1.buildForV1Write())
-            case v2 => writeWithV2(v2.buildForBatch())
+          val write = writeBuilder.build()
+          val writtenRows = write match {

Review comment:
       I don't feel strongly about this place and can update it. However, I do 
prefer to split different logical parts into different variables. Here, I've 
separated building a logical write from actually writing the records. Let me 
know what are your thoughts, @jzhuge.




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



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

Reply via email to