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

   ### Describe the bug
   
   `make_comparator` accepts two decimal arrays of the same width but different 
scales and compares their raw unscaled values, resulting in incorrect results. 
Such inputs should probably be rejected (as we do for decimals with different 
widths).
   
   ### To Reproduce
   
   ```rust
   use arrow_array::Decimal128Array;
   use arrow_ord::ord::make_comparator;
   use arrow_schema::SortOptions;
   
   // 1.00 at scale 2
   let a = Decimal128Array::from(vec![100])
       .with_precision_and_scale(10, 2)
       .unwrap();
   // 0.500 at scale 3
   let b = Decimal128Array::from(vec![500])
       .with_precision_and_scale(10, 3)
       .unwrap();
   
   let cmp = make_comparator(&a, &b, SortOptions::default()).unwrap();
   cmp(0, 0); // Ordering::Less — claims 1.00 < 0.500
   ```
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


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