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

Method Add

be/src/runtime/timestamp-value.cc:279–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279TimestampValue TimestampValue::Add(const boost::posix_time::time_duration& t) const {
280 if (!IsValidTime(t) || !HasDateAndTime()) return TimestampValue();
281
282 int64_t this_in_nano_sec = time_.total_nanoseconds();
283 int64_t t_in_nano_sec = t.total_nanoseconds();
284
285 if (this_in_nano_sec + t_in_nano_sec < NANOS_PER_DAY) {
286 return TimestampValue(date_, time_ + t);
287 } else {
288 int64_t total_in_nano_sec = this_in_nano_sec + t_in_nano_sec;
289 int64_t days = total_in_nano_sec / NANOS_PER_DAY;
290 int64_t nano_secs_remaining = total_in_nano_sec % NANOS_PER_DAY;
291 return TimestampValue(date_ + boost::gregorian::date_duration(days),
292 boost::posix_time::time_duration(0, 0, 0, nano_secs_remaining));
293 }
294}
295
296TimestampValue TimestampValue::Subtract(const boost::posix_time::time_duration& t) const {
297 if (!IsValidTime(t) || !HasDateAndTime()) return TimestampValue();

Callers 15

getContextMethod · 0.45
postWriteMethod · 0.45
RegisterMethod · 0.45
UnRegisterMethod · 0.45
newThreadMethod · 0.45
InitMethod · 0.45
InitMemTrackerMethod · 0.45
InitMethod · 0.45
TEST_FFunction · 0.45
FinalizeHdfsInsertMethod · 0.45
InitMethod · 0.45

Calls 2

time_durationClass · 0.85
TimestampValueClass · 0.70

Tested by 15

TEST_FFunction · 0.36
CreateQueryStateMethod · 0.36
TestRowBatchLimitsMethod · 0.36
CreateRowBatchMethod · 0.36
TestDupCorrectnessMethod · 0.36
TestDupRemovalMethod · 0.36
TestConsecutiveNullsMethod · 0.36
TEST_FFunction · 0.36
SetUpMethod · 0.36
GetNextInstanceIdMethod · 0.36
CreateRowDescMethod · 0.36
CreateTupleComparatorMethod · 0.36