Github user davies commented on the pull request:

    https://github.com/apache/spark/pull/8409#issuecomment-134488372
  
    @yhuai For Add/Sub/Multiply, we should not lose precision (we can't reduce 
the scale of result, prefer overflow), but for division, we can't keep all the 
precision under zero anyway, then we could have a maximum scale, or preserve 
the range first. 
    
    From MS SQL Server: https://msdn.microsoft.com/en-us/library/ms190476.aspx
    
    ```* The result precision and scale have an absolute maximum of 38. When a 
result precision is greater than 38, the corresponding scale is reduced to 
prevent the integral part of a result from being truncated.
    ```
    
    To be safe, I think we should only do this for division, or we will lose 
precision silently for add/sub/multiply (it does overflow in Hive). 



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to