You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/10/16 00:12:46 UTC

[GitHub] [spark] maropu commented on a change in pull request #30001: [SPARK-33112][SQL] Avoid executeBatch when JDBC does not support batch updates

maropu commented on a change in pull request #30001:
URL: https://github.com/apache/spark/pull/30001#discussion_r505932800



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala
##########
@@ -675,15 +676,19 @@ object JdbcUtils extends Logging {
             }
             i = i + 1
           }
-          stmt.addBatch()
-          rowCount += 1
-          totalRowCount += 1
-          if (rowCount % batchSize == 0) {
-            stmt.executeBatch()
-            rowCount = 0
+          if (supportsBatchUpdates) {

Review comment:
       Could you pull this check out from the loop? I think we don't need to check it in every iterations.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org