liukun4515 opened a new issue, #2256:
URL: https://github.com/apache/arrow-rs/issues/2256

   **Describe the bug**
   Decimal128 as a example, we use the [u8;16] to store the value of the 
decimal.
   
   In order to compare the decimal128, we should use the signed compare order.
   
   But the current implementation just compare the [u8;16] to get the order.
   
   For example:
   `Decimal128(-1, 10,0)`.cmp(`Decimal128(129,10,0)` will get the result of 
Greater.
   
   **To Reproduce**
   
   ```
       #[test]
       fn compare_i128() {
           let v: i128 = -1;
           let b1: [u8; 16] = v.to_le_bytes();
           let b2: [u8; 16] = 129_i128.to_le_bytes();
           println!("{:?}", b1);
           println!("{:?}", b2);
           if b1.eq(&b2) {
               println!("=")
           }
           println!("{:?}", b1.cmp(&b2));
       }
   ```
   
   **Expected behavior**
   <!--
   A clear and concise description of what you expected to happen.
   -->
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->


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