viirya commented on issue #6278: URL: https://github.com/apache/arrow-datafusion/issues/6278#issuecomment-1540476554
> I think the major problem is that the `i256` math operation is not efficient. As I mentioned above (https://github.com/apache/arrow-datafusion/issues/6278#issuecomment-1539232844), `divide_and_round` spent too much time on i256 operations, especially `wrapping_div` and `wrapping_rem`. We currently round back to BigInt for these math operations which are slow. > And the logic in the method `multiply_fixed_point()` in arrow-rs is not consistent. > > `If required_scale == product_scale`, it still uses `i128` for multiply(can still overflow) `if product_scale > required_scale`, use `i256` for multiply and div, why ?? It is not consistent. It is for allowing precision-loss decimal multiplication. Our kernels basically allow overflow. If `required_scale` equals to `product_scale`, it won't lose precision, so we can use i128. If `product_scale` is larger than `required_scale`, the multiplication will lose precision, we need to multiply in i256 and divide the result to get the result with less precision. -- 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]
