MCPcopy Create free account
hub / github.com/apache/impala / SetCenturyBreakAndCurrentTime

Method SetCenturyBreakAndCurrentTime

be/src/runtime/datetime-parser-common.cc:39–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37namespace datetime_parse_util {
38
39void DateTimeFormatContext::SetCenturyBreakAndCurrentTime(const TimestampValue& now) {
40 current_time = &now;
41 const boost::gregorian::date& now_date = now.date();
42 // If the century break is at an invalid 02/29, set it to 02/28 for consistency with
43 // Hive.
44 if (now_date.month() == 2 && now_date.day() == 29 &&
45 !boost::gregorian::gregorian_calendar::is_leap_year(now_date.year() - 80)) {
46 century_break_ptime = boost::posix_time::ptime(
47 boost::gregorian::date(now_date.year() - 80, 2, 28), now.time());
48 } else {
49 century_break_ptime = boost::posix_time::ptime(
50 boost::gregorian::date(now_date.year() - 80, now_date.month(), now_date.day()),
51 now.time());
52 }
53 DCHECK(!century_break_ptime.is_special());
54}
55
56void DateTimeFormatContext::Reset(const char* fmt, int fmt_len) {
57 this->fmt = fmt;

Callers 5

OpenEvaluatorMethod · 0.80
UnixAndFromUnixPrepareFunction · 0.80
TESTFunction · 0.80
RunMethod · 0.80
RunMethod · 0.80

Calls 3

monthMethod · 0.80
dayMethod · 0.80
yearMethod · 0.80

Tested by 3

TESTFunction · 0.64
RunMethod · 0.64
RunMethod · 0.64