arjunashok commented on code in PR #41:
URL: 
https://github.com/apache/cassandra-analytics/pull/41#discussion_r1513798245


##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/CassandraBulkSourceRelation.java:
##########
@@ -107,17 +112,25 @@ private void persist(@NotNull JavaPairRDD<DecoratedKey, 
Object[]> sortedRDD, Str
     {
         try
         {
-            sortedRDD.foreachPartition(writeRowsInPartition(broadcastContext, 
columnNames));
+            List<StreamResult> results = sortedRDD
+                                         
.mapPartitions(partitionsFlatMapFunc(broadcastContext, columnNames))
+                                         .collect();
+            long rowCount = results.stream().mapToLong(res -> 
res.rowCount).sum();
+            long totalBytesWritten = results.stream().mapToLong(res -> 
res.bytesWritten).sum();
+            LOGGER.info("Bulk writer has written {} rows and {} bytes", 
rowCount, totalBytesWritten);
+            recordSuccessfulJobStats(rowCount, totalBytesWritten);
         }
         catch (Throwable throwable)
         {
+            recordFailureStats(throwable.getMessage());
             LOGGER.error("Bulk Write Failed", throwable);
             throw new RuntimeException("Bulk Write to Cassandra has failed", 
throwable);
         }
         finally
         {
             try
             {
+                writerContext.publishJobStats();

Review Comment:
   So, the change is not propagating data back to the driver, but publishes 
stats from the executors. I am assuming here that the context is made available 
to the executors so what you are saying does not need to happen. Let me know if 
that makes sense.
   
   I have been able to validate this using the in-jvm-dtests.



-- 
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: commits-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to