klion26 commented on PR #9689:
URL: https://github.com/apache/arrow-rs/pull/9689#issuecomment-4327047818

   After some modifications and run multiple benchmarks, the current situation 
is as follows: currently, most of the benchmarks are basically the same, but 
`decimal32 -> uint/int` will have some regress (`decimal 64/126/256 -> 
uint/int` has not show these regressions), the regression between 3% and 
20%.[1][2][3][4](These four have not modified the logic about these benchmarks 
-- `decimal -> int && cast.safe =true && decimal.scale > 0`)
   
   The change abount decimal -> int is as follows
   
   the original
   ```
   let v = array
           .value(i)
                .div_checked(div)
                .ok()
                .and_then(<T::Native as NumCast>::from::<D::Native>);
   ```
   changed to
   ```
   let v = cast_single_decimal_to_integer_div_opt::<D, 
T::Native>(array.value(i), div);
   #[inline(always)]
   pub fn cast_single_decimal_to_integer_div_opt<D, T>(value: D::Native, div: 
D::Native) -> Option<T>
   where 
     T: NumCast + ToPrimitive,
     D: DecimalType + ArrowPrimitiveType,
     <D as ArrowPrimitiveType>::Native: ToPrimitive,
   {
      let v = value.div_checked(div).ok()?
      <T as NumCast>::from::<D::Native>(v)
   }
   ```
   
   This modification was to let arrow-cast and variant reuse the same code. So 
do we need to keep the current logic in current pr now, or revert the logic in 
arrow-cast, and maintain the `single_decimal_to_integer` seperate in 
`arrow-cast` and variant?
   
   [1] https://github.com/apache/arrow-rs/pull/9689#issuecomment-4313109116
   [2] https://github.com/apache/arrow-rs/pull/9689#issuecomment-4313535414
   [3] https://github.com/apache/arrow-rs/pull/9689#issuecomment-4314011571
   [4] https://github.com/apache/arrow-rs/pull/9689#issuecomment-4325051587


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