guanlisheng commented on code in PR #9013:
URL: https://github.com/apache/hudi/pull/9013#discussion_r1236443027


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/UpsertPartitioner.java:
##########
@@ -384,7 +377,7 @@ protected static long averageBytesPerRecord(HoodieTimeline 
commitTimeline, Hoodi
               .fromBytes(commitTimeline.getInstantDetails(instant).get(), 
HoodieCommitMetadata.class);
           long totalBytesWritten = commitMetadata.fetchTotalBytesWritten();
           long totalRecordsWritten = commitMetadata.fetchTotalRecordsWritten();
-          if (totalBytesWritten > fileSizeThreshold && totalRecordsWritten > 
0) {
+          if (totalBytesWritten > fileSizeThreshold && totalBytesWritten <= 
fileSizeUpper && totalRecordsWritten > 0) {
             avgSize = (long) Math.ceil((1.0 * totalBytesWritten) / 
totalRecordsWritten);
             break;

Review Comment:
   you are correct and I misunderstood the `totalBytesWritten`.  
   
   then there might be two options:
   1. consider extra FilesInsert/FileUpdated 
   2. filter out REPLACE commit within the `averageBytesPerRecord` function. 
   
   which one do you prefer?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to