danny0405 commented on a change in pull request #1618: [hotfix] Fixed an issue
where overflow from Long to Int was unsafe
URL: https://github.com/apache/calcite/pull/1618#discussion_r352391116
##########
File path: core/src/main/java/org/apache/calcite/rex/RexInterpreter.java
##########
@@ -213,7 +213,7 @@ private Comparable extract(RexCall call, List<Comparable>
values) {
final int v2;
if (v instanceof Long) {
// TIMESTAMP
- v2 = (int) (((Long) v) / TimeUnit.DAY.multiplier.longValue());
+ v2 = Math.toIntExact(((Long) v) / TimeUnit.DAY.multiplier.longValue());
Review comment:
Why do you think a integer days would overflow ? Can you give a test case ?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services