Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Impala 1.4, Impala 2.0
-
None
-
None
Description
See example below, the middle query.
(Shell build version: Impala Shell v1.4.3-cdh5 (baae97f) built on Wed Nov 19 11:24:04 PST 2014) [nightly51-3.ent.cloudera.com:21000] > select now(); Query: select now() +-------------------------------+ | now() | +-------------------------------+ | 2015-01-19 15:00:37.092593000 | +-------------------------------+ Returned 1 row(s) in 1.52s [nightly51-3.ent.cloudera.com:21000] > select now() - interval 10000 year; Query: select now() - interval 10000 year +-------------------------------+ | now() - interval 10000 year | +-------------------------------+ | 2937-09-19 15:00:49.791833000 | +-------------------------------+ Returned 1 row(s) in 0.23s [nightly51-3.ent.cloudera.com:21000] > select now() - interval 700 year; Query: select now() - interval 700 year Application Exception : Year is out of valid range: 1400..10000
Impala inherited this bug from boost. Boost seems to only throw an exception if the result is near the edges of its supported values, otherwise some sort of wrap-around happens.
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <iostream>
using namespace std;
using namespace boost::posix_time;
using namespace boost::gregorian;
int main() {
cout << date(2000, Jan, 1) - years(6001) << endl;
cout << date(2000, Jan, 1) - years(601) << endl;
}
output
1460-May-01 terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_year> >' what(): Year is out of valid range: 1400..10000
Attachments
Issue Links
- is related to
-
IMPALA-7522 milliseconds_add() can lead to overflow / DCHECK
- Resolved