zhilinli123 commented on PR #4772:
URL: https://github.com/apache/seatunnel/pull/4772#issuecomment-1578052292

   > > It's not a negative number, right? @Hisoka-X
   > 
   > @zhilinli123 It can't be negative. I suggest compare two result of change 
before and change after.
   
      ```
   @Test
       public void testHashValue() {
           String a = "a,b,c,d,e,f";
           for (Object o : Arrays.stream(a.split(",")).toArray()) {
               System.out.println(getShard(o));
           }
       }
       public int getShard(Object shardValue) {
           int offset =
                   (int)
                           (HASH_INSTANCE.hash(
                                   ByteBuffer.wrap(
                                           shardValue
                                                   .toString()
                                                   
.getBytes(StandardCharsets.UTF_8)),
                                   0)
                                           & Long.MAX_VALUE % 6);
           return offset;
       }
   
   ```
   ```
   //  Before            After
   //  1                   -5
   //  1                   3
   //  1                   -5
   //  0                   2
   //  0                   4
   //  1                   -3
   ```


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