nsivabalan commented on a change in pull request #1868:
URL: https://github.com/apache/hudi/pull/1868#discussion_r465152007



##########
File path: 
hudi-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -252,8 +250,27 @@ public void testUpsertPartitionerWithSmallInsertHandling() 
throws Exception {
     assertEquals(BucketType.INSERT, partitioner.getBucketInfo(2).bucketType,
         "Bucket 2 is INSERT");
     assertEquals(3, insertBuckets.size(), "Total of 3 insert buckets");
-    assertEquals(0, insertBuckets.get(0).bucketNumber, "First insert bucket 
must be same as update bucket");
-    assertEquals(0.5, insertBuckets.get(0).weight, 0.01, "First insert bucket 
should have weight 0.5");
+
+    assertEquals(0, insertBuckets.get(0).getKey().bucketNumber,
+        "First insert bucket must be same as update bucket");

Review comment:
       lets avoid doing one at a time w/ hardcoded expected values. I mean, we 
should try to do in a loop. Can we build a map of <index -> ExpectedValue>. 
ExpectedValue should contain bucketNo, bucketType, weight, cumulativeWeight. 
Once we have this, these 20 lines of assertions will be folded to just 4 to 5 
lines. 

##########
File path: 
hudi-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -269,8 +286,34 @@ public void testUpsertPartitionerWithSmallInsertHandling() 
throws Exception {
     assertEquals(BucketType.INSERT, partitioner.getBucketInfo(3).bucketType,
         "Bucket 3 is INSERT");
     assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
-    assertEquals(0, insertBuckets.get(0).bucketNumber, "First insert bucket 
must be same as update bucket");
-    assertEquals(200.0 / 2400, insertBuckets.get(0).weight, 0.01, "First 
insert bucket should have weight 0.5");
+
+    assertEquals(0, insertBuckets.get(0).getKey().bucketNumber,

Review comment:
       same as above. Can we try to fold this up in a loop.




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


Reply via email to