ZhangHuiGui commented on PR #40969:
URL: https://github.com/apache/arrow/pull/40969#issuecomment-2034110909

   @lidavidm @bkietz I'm not understand the previous decimal division rules.
   
   We will cast the decimal type int `CastBinaryDecimalArgs` before execute.
   
https://github.com/apache/arrow/blob/be3b78902ff2871e637af2c340e24b75853e32e7/cpp/src/arrow/compute/kernels/codegen_internal.cc#L435-L437
   
   And the reason why we need change input-types' scale and precision here is 
that the division operation of BasicDecimal needs to cast decimal1-array to the 
maximum precision supported by the current operation and then perform division? 
(Below codes shows that we will cast the args[0] to the  precision and scale 
which fetched from `CastBinaryDecimalArgs`)
   
https://github.com/apache/arrow/blob/be3b78902ff2871e637af2c340e24b75853e32e7/cpp/src/arrow/compute/function.cc#L245-L247
   
   


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