Add the "throwIfOverflow" flag to methods that may throw an exception due to overflow #7358
liujiayi771
started this conversation in
General
Replies: 2 comments 2 replies
-
@mbasmanova What do you think, should we add template parameters to these methods or introduce a new method? |
Beta Was this translation helpful? Give feedback.
0 replies
-
@liujiayi771 I'm not sure I understand, but there are version of these functions that do not check for overflow in velox/functions/prestosql/ArithmeticImpl.h |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, there are many methods in Velox that may encounter overflow during the calculation process. Velox currently defaults to throwing an exception when an overflow occurs. However, in Spark, it returns null when an overflow occurs. To resolve this conflict, the DecimalUtil in Spark has introduced corresponding methods that do not throw exceptions. To fundamentally address this issue, these methods need to have a "throwIfOverflow" flag added to them. Additionally, these functions are usually used in hot paths, so it may be necessary to consider making the flag a template parameter.
velox/velox/common/base/CheckedArithmetic.h
Lines 46 to 54 in fcc49a6
velox/velox/functions/sparksql/DecimalUtil.h
Lines 105 to 110 in fcc49a6
Beta Was this translation helpful? Give feedback.
All reactions