maropu commented on a change in pull request #26109: [SPARK-29461][SQL] Measure
the number of records being updated for JDBC writer
URL: https://github.com/apache/spark/pull/26109#discussion_r337857162
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala
##########
@@ -673,12 +673,12 @@ object JdbcUtils extends Logging {
stmt.addBatch()
rowCount += 1
if (rowCount % batchSize == 0) {
- stmt.executeBatch()
+ totalUpdatedRows += stmt.executeBatch().sum
rowCount = 0
}
}
if (rowCount > 0) {
- stmt.executeBatch()
+ totalUpdatedRows += stmt.executeBatch().sum
Review comment:
`SparkHadoopWriter` uses a row count as the metric:
https://github.com/apache/spark/blob/c128ac564d198effe6bb9754489ea32133dfeb89/core/src/main/scala/org/apache/spark/internal/io/SparkHadoopWriter.scala#L136
Since the returned values of `stmt.executeBatch` seems to be JDBC
implementation specific, IMHO its ok to just do the same with
`SparkHadoopWriter`
----------------------------------------------------------------
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]