Csaba Ringhofer has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/11390


Change subject: IMPALA-7522: Fix overflow in milliseconds_add()
......................................................................

IMPALA-7522: Fix overflow in milliseconds_add()

Adding milliseconds to a timestamp lead to overflow if
the interval is very large. This hit a DCHECK in debug
builds and returned incorrect results in release builds.

The following queries returned 2237-09-01 05:47:53.709551616
before the fix while the correct result is 1653-02-10 06:13:20:
select milliseconds_add("1970-01-01", -10000000000000);
select CAST(0 AS TIMESTAMP) + INTERVAL -10000000000000 MILLISECONDS;

Testing:
- added new test to expr-test.cc + ran it
- generally there are no tests for the *_add form, only the
  + INTERVAL ... form. The two means the same, so I did not
  duplicate the test.

Change-Id: I491389257d6560873d942ac4f9a0fd836cc216da
---
M be/src/exprs/expr-test.cc
M be/src/exprs/timestamp-functions-ir.cc
2 files changed, 12 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/90/11390/1
--
To view, visit http://gerrit.cloudera.org:8080/11390
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I491389257d6560873d942ac4f9a0fd836cc216da
Gerrit-Change-Number: 11390
Gerrit-PatchSet: 1
Gerrit-Owner: Csaba Ringhofer <[email protected]>

Reply via email to