You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2020/07/16 13:01:26 UTC

[GitHub] [hudi] shenh062326 opened a new pull request #1838: [HUDI-1082] Fix minor bug in deciding the insert buckets

shenh062326 opened a new pull request #1838:
URL: https://github.com/apache/hudi/pull/1838


   ## What is the purpose of the pull request
   
   * Fix minor bug in deciding the insert buckets
   
   ## Brief change log
   
   *(for example:)*
     - *Modify AnnotationLocation checkstyle rule in checkstyle.xml*
   
   ## Verify this pull request
   
   *(Please pick either of the following options)*
   
   This pull request is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This pull request is already covered by existing tests, such as *(please describe tests)*.
   
   (or)
   
   This change added tests and can be verified as follows:
   
   *(example:)*
   
     - *Added integration tests for end-to-end.*
     - *Added HoodieClientWriteTest to verify the change.*
     - *Manually verified the change by running a job locally.*
   
   ## Committer checklist
   
    - [ ] Has a corresponding JIRA in PR title & commit
    
    - [ ] Commit message is descriptive of the change
    
    - [ ] CI is green
   
    - [ ] Necessary doc changes done or have another open PR
          
    - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.


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



[GitHub] [hudi] leesf commented on pull request #1838: [HUDI-1082] Fix minor bug in deciding the insert buckets

Posted by GitBox <gi...@apache.org>.
leesf commented on pull request #1838:
URL: https://github.com/apache/hudi/pull/1838#issuecomment-660082919


   @nsivabalan would you please take a look on this PR?


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



[GitHub] [hudi] shenh062326 commented on pull request #1838: [HUDI-1082] Fix minor bug in deciding the insert buckets

Posted by GitBox <gi...@apache.org>.
shenh062326 commented on pull request #1838:
URL: https://github.com/apache/hudi/pull/1838#issuecomment-660458165


   > Can you add a simple test to ensure the no of records inserted to a bucket approx matches the bucket weight. If we already have one, do refer it here.
   
   Sure, I will add a testcase.


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



[GitHub] [hudi] vinothchandar commented on pull request #1838: [HUDI-1082] Fix minor bug in deciding the insert buckets

Posted by GitBox <gi...@apache.org>.
vinothchandar commented on pull request #1838:
URL: https://github.com/apache/hudi/pull/1838#issuecomment-662829522


   @shenh062326 are you able to add this as a test case and update the PR? 


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



[GitHub] [hudi] shenh062326 edited a comment on pull request #1838: [HUDI-1082] Fix minor bug in deciding the insert buckets

Posted by GitBox <gi...@apache.org>.
shenh062326 edited a comment on pull request #1838:
URL: https://github.com/apache/hudi/pull/1838#issuecomment-660458165


   > Can you add a simple test to ensure the no of records inserted to a bucket approx matches the bucket weight. If we already have one, do refer it here.
   
   Sure, I will add a test.


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



[GitHub] [hudi] nsivabalan merged pull request #1838: [HUDI-1082] Fix minor bug in deciding the insert buckets

Posted by GitBox <gi...@apache.org>.
nsivabalan merged pull request #1838:
URL: https://github.com/apache/hudi/pull/1838


   


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



[GitHub] [hudi] shenh062326 commented on pull request #1838: [HUDI-1082] Fix minor bug in deciding the insert buckets

Posted by GitBox <gi...@apache.org>.
shenh062326 commented on pull request #1838:
URL: https://github.com/apache/hudi/pull/1838#issuecomment-662849527


   > @shenh062326 are you able to add this as a test case and update the PR?
   
   Sure, I will try to add a testcase.


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



[GitHub] [hudi] shenh062326 commented on pull request #1838: [HUDI-1082] Fix minor bug in deciding the insert buckets

Posted by GitBox <gi...@apache.org>.
shenh062326 commented on pull request #1838:
URL: https://github.com/apache/hudi/pull/1838#issuecomment-660575757


   Add test in TestUpsertPartitioner, set partition newInsertBucket0.weight = 0.3, newInsertBucket1.weight = 0.7.
   
   ```
     @Test
     public void testGetPartitioner2() throws Exception {
       String testPartitionPath1 = "2016/09/26";
       HoodieWriteConfig config = makeHoodieClientConfigBuilder()
               .withCompactionConfig(HoodieCompactionConfig.newBuilder().compactionSmallFileSize(0)
                       .insertSplitSize(100).autoTuneInsertSplits(false).build())
               .withStorageConfig(HoodieStorageConfig.newBuilder().limitFileSize(1000 * 1024).build()).build();
   
       HoodieClientTestUtils.fakeCommitFile(basePath, "001");
       metaClient = HoodieTableMetaClient.reload(metaClient);
       HoodieCopyOnWriteTable table = (HoodieCopyOnWriteTable) HoodieTable.create(metaClient, config, hadoopConf);
       HoodieTestDataGenerator dataGenerator1 = new HoodieTestDataGenerator(new String[] {testPartitionPath1});
       List<HoodieRecord> insertRecords1 = dataGenerator1.generateInserts("001", 200);
       List<HoodieRecord> records1 = new ArrayList<>();
       records1.addAll(insertRecords1);
   
       WorkloadProfile profile = new WorkloadProfile(jsc.parallelize(records1));
       UpsertPartitioner partitioner = new UpsertPartitioner(profile, jsc, table, config);
       List<InsertBucket> insertBuckets = partitioner.getInsertBuckets(testPartitionPath1);
       InsertBucket newInsertBucket0 = new InsertBucket();
       newInsertBucket0.bucketNumber = 0;
       newInsertBucket0.weight = 0.3;
       insertBuckets.remove(0);
       insertBuckets.add(0, newInsertBucket0);
   
       InsertBucket newInsertBucket1 = new InsertBucket();
       newInsertBucket1.bucketNumber = 1;
       newInsertBucket1.weight = 0.7;
       insertBuckets.remove(1);
       insertBuckets.add(1, newInsertBucket1);
   
       Map<Integer, Integer> partition2numRecords = new HashMap<Integer, Integer>();
       for (HoodieRecord hoodieRecord: insertRecords1) {
         int partition = partitioner.getPartition(new Tuple2<>(
                 hoodieRecord.getKey(), Option.ofNullable(hoodieRecord.getCurrentLocation())));
         if (!partition2numRecords.containsKey(partition)) {
           partition2numRecords.put(partition, 0);
         }
         int num = partition2numRecords.get(partition);
         partition2numRecords.put(partition, num + 1);
       }
       System.out.println(partition2numRecords);
     }
   ```
   
   Test it five times, the results show that the number of records inserted to a bucket approximately matches the bucket weight.
   ```
   {0=66, 1=134}
   {0=63, 1=137}
   {0=64, 1=136}
   {0=67, 1=133}
   {0=68, 1=132}
   ```


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