imay commented on a change in pull request #1600: Fix timediff can't support 
time berfore 1970
URL: https://github.com/apache/incubator-doris/pull/1600#discussion_r311509614
 
 

 ##########
 File path: be/src/exprs/timestamp_functions.cpp
 ##########
 @@ -462,17 +462,18 @@ IntVal TimestampFunctions::to_days(
     return IntVal(ts_value.daynr());
 }
 
-// TODO(dhc): implement this funciton really
 DoubleVal TimestampFunctions::time_diff(
         FunctionContext* ctx, const DateTimeVal& ts_val1, const DateTimeVal& 
ts_val2) {
     if (ts_val1.is_null || ts_val2.is_null) {
         return DoubleVal::null();
     }
     const DateTimeValue& ts_value1 = DateTimeValue::from_datetime_val(ts_val1);
     const DateTimeValue& ts_value2 = DateTimeValue::from_datetime_val(ts_val2);
-    int64_t timediff = ts_value1.unix_timestamp() - ts_value2.unix_timestamp();
 
-    return DoubleVal(timediff);
+    int day_diff = ts_value1.daynr() - ts_value2.daynr();
 
 Review comment:
   Can you encapsulate a function return seconds since 0000-01-01 in 
DateTimeValue?

----------------------------------------------------------------
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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to