Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix toMillis should work for all presto timestamps (facebookincubator…
…#7506) Summary: Pull Request resolved: facebookincubator#7506 Presto timestamps are in the range TimeStamp::minMillis() to TimeStamp::maxMillis(). moreover minMillis has a comment: ``` // The minimum Timestamp that toMillis() method will not overflow. // Used to calculate the minimum value of the Presto timestamp. ``` Before this diff TimeStamp::minMillis().toMillis throws because the computation overflows. However in that case we multiply negative number then add positive number so the final result still fits in int64_t. It is important the toMillis does not throw when it should not, since it is used in functions like inPredicate() and other functions that do not expect it to throw for some values. Throwing will show up as incorrect results compared to presto. This diff fixes that . I wonder if we shall throw a runtime error in toMillis() instead. found while investigating facebookincubator#7161 Reviewed By: kagamiori Differential Revision: D51177715 fbshipit-source-id: 5ec2d4d9c5448f7951a795ffb7a8c5c36fdee15f
- Loading branch information