xicm commented on issue #11288:
URL: https://github.com/apache/hudi/issues/11288#issuecomment-2129890980

   Some tests
   ```
   package org.example;
   
   import java.util.ArrayList;
   import java.util.Comparator;
   import java.util.List;
   
   
   public class Test {
   
       public static void main(String[] args) {
           List<Integer> list1 = new ArrayList<Integer>();
           List<Integer> list2 = new ArrayList<Integer>();
           List<Integer> list3 = new ArrayList<Integer>();
           List<Integer> list4 = new ArrayList<Integer>();
           List<Integer> list5 = new ArrayList<Integer>();
           List<Integer> list6 = new ArrayList<Integer>();
   
           System.out.println("bucket_num % parallelism");
   
           for (int i = 0; i < 20; i++) {
               list1.add(i % 20);
           }
           for (int i = 0; i < 20; i++) {
               list1.add(i % 20);
           }
   
           list1.sort(Comparator.naturalOrder());
           for (int n : list1) {
               System.out.print(n);
               System.out.print(" ");
           }
   
           System.out.println();
           System.out.println("Hash(partition + bucket_num) % parallelism");
           System.out.println("parallelism = 20");
   
           for (int i = 0; i < 20; i++) {
               list2.add((("part1" + i).hashCode() & Integer.MAX_VALUE) % 20);
           }
           for (int i = 0; i < 20; i++) {
               list2.add((("part2" + i).hashCode() & Integer.MAX_VALUE) % 20);
           }
   
           list2.sort(Comparator.naturalOrder());
           for (int n : list2) {
               System.out.print(n);
               System.out.print(" ");
           }
   
           System.out.println();
           System.out.println("(Hash(partition) + bucket_num) % parallelism");
           System.out.println("parallelism = 20");
   
           for (int i = 0; i < 20; i++) {
               list3.add((("part1".hashCode() & Integer.MAX_VALUE) + i) % 20);
           }
           for (int i = 0; i < 20; i++) {
               list3.add((("part2".hashCode() & Integer.MAX_VALUE) + i) % 20);
           }
   
           list3.sort(Comparator.naturalOrder());
           for (int n : list3) {
               System.out.print(n);
               System.out.print(" ");
           }
   
           System.out.println();
           System.out.println("(Hash(partition) % parallelism + bucket_num) % 
parallelism");
           System.out.println("parallelism = 20");
   
           for (int i = 0; i < 20; i++) {
               list4.add((("part1".hashCode() & Integer.MAX_VALUE) + i) % 20);
           }
           for (int i = 0; i < 20; i++) {
               list4.add((("part2".hashCode() & Integer.MAX_VALUE) + i) % 20);
           }
   
           list4.sort(Comparator.naturalOrder());
           for (int n : list4) {
               System.out.print(n);
               System.out.print(" ");
           }
   
           System.out.println();
           System.out.println("(Hash(partition) % parallelism + bucket_num) % 
parallelism");
           System.out.println("parallelism = 40");
   
           // bucket_num = 20, parallelism = 40
           for (int i = 0; i < 20; i++) {
               list5.add((("part1".hashCode() & Integer.MAX_VALUE) % 40 + i) % 
40);
           }
           for (int i = 0; i < 20; i++) {
               list5.add((("part2".hashCode() & Integer.MAX_VALUE) % 40 + i) % 
40);
           }
   
           list5.sort(Comparator.naturalOrder());
           for (int n : list5) {
               System.out.print(n);
               System.out.print(" ");
           }
   
           System.out.println();
           System.out.println("(Hash(partition) % parallelism * bucket_num + 
bucket_num) % parallelism");
           System.out.println("parallelism = 40");
   
           for (int i = 0; i < 20; i++) {
               list6.add((("part1".hashCode() & Integer.MAX_VALUE) % 40 * 20 + 
i) % 40);
           }
           for (int i = 0; i < 20; i++) {
               list6.add((("part2".hashCode() & Integer.MAX_VALUE) % 40 * 20 + 
i) % 40);
           }
   
           list6.sort(Comparator.naturalOrder());
           for (int n : list6) {
               System.out.print(n);
               System.out.print(" ");
           }
   
       }
   }
   
   ```
   
   
![image](https://github.com/apache/hudi/assets/36392121/ae1f9588-9eff-4560-94ed-f6e59fe39b57)
   
   


-- 
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...@hudi.apache.org

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

Reply via email to