You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "viirya (via GitHub)" <gi...@apache.org> on 2023/03/21 21:01:07 UTC

[GitHub] [arrow-datafusion] viirya opened a new issue, #5674: Decimal multiply kernel may cause precision loss

viirya opened a new issue, #5674:
URL: https://github.com/apache/arrow-datafusion/issues/5674

   **Describe the bug**
   <!--
   A clear and concise description of what the bug is.
   -->
   
   Currently decimal multiply kernel (`multiply_dyn_decimal`) sets original scale by a divide operation. It tries to restore the scale assuming lhs and rhs have the same scale. For example, multiply two decimals (-491, -591) with precision/scale (5, 2), it will divide 290181 by 2 to get the result 29.01 with same precision/scale (5, 2). But by doing this, it loses decimal precision. For example, in Spark, the answer is 29.0181 with precision/scale (11, 4).
   
   **To Reproduce**
   <!--
   Steps to reproduce the behavior:
   -->
   
   **Expected behavior**
   <!--
   A clear and concise description of what you expected to happen.
   -->
   
   I'd expect that it behaves like Spark as mentioned above.
   
   **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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] mustafasrepo commented on issue #5674: Decimal multiply kernel may cause precision loss

Posted by "mustafasrepo (via GitHub)" <gi...@apache.org>.
mustafasrepo commented on issue #5674:
URL: https://github.com/apache/arrow-datafusion/issues/5674#issuecomment-1480670412

   > 
   
   I guess you meant -4.91 and -5.91 instead of (-491 and -591). 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] Dandandan commented on issue #5674: Decimal multiply kernel may cause precision loss

Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan commented on issue #5674:
URL: https://github.com/apache/arrow-datafusion/issues/5674#issuecomment-1481503030

   Also see
   https://github.com/apache/arrow-datafusion/issues/5143


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] Dandandan closed issue #5674: Decimal multiply kernel may cause precision loss

Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan closed issue #5674: Decimal multiply kernel may cause precision loss
URL: https://github.com/apache/arrow-datafusion/issues/5674


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] viirya commented on issue #5674: Decimal multiply kernel may cause precision loss

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on issue #5674:
URL: https://github.com/apache/arrow-datafusion/issues/5674#issuecomment-1481474306

   Yes, -491 and -591 are their i128 representation in the array with precision/scale (5, 2).


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org