viirya commented on PR #3690:
URL: https://github.com/apache/arrow-rs/pull/3690#issuecomment-1457036830

   > So if I am following correctly, take the example of an array containing 
`[1, 10, 100]` multiplied by itself, with scale 2 and precision 3
   > 
   > In spark this will result in
   > 
   > ```
   > 1: {value: 1, scale: 2, precision: 3},
   > 2: {value: 100, scale: 2, precision: 3},
   > 3: {value: 100, scale: 0, precision: 3},
   > ```
   
   I guess the some values are incorrect. `{value: 100, scale: 0, precision: 
3}` is 100.0, but I think the correct one should be 1.0? I guess you mean 
`{value: 1, scale: 0, precision: 3}`? I guess the result (if max precision is 
3) is:
   
   ```
   1: {value: 0, scale: 0, precision: 3},
   2: {value: 1, scale: 2, precision: 3},
   3: {value: 100, scale: 2, precision: 3},
   ```
   
   Spark will insert a followup expression to make a final precision/scale for 
decimal. So the final result will be adjusted to same precision/scale again.
   
   


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