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

Method TimestampAvgGetValue

be/src/exprs/aggregate-functions-ir.cc:1025–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1023}
1024
1025TimestampVal AggregateFunctions::TimestampAvgGetValue(FunctionContext* ctx,
1026 const StringVal& src) {
1027 AvgState* val_struct = reinterpret_cast<AvgState*>(src.ptr);
1028 if (val_struct->count == 0) return TimestampVal::null();
1029 const TimestampValue& tv = TimestampValue::FromSubsecondUnixTime(
1030 val_struct->sum / val_struct->count, UTCPTR);
1031 if (tv.HasDate()) {
1032 TimestampVal result;
1033 tv.ToTimestampVal(&result);
1034 return result;
1035 } else {
1036 return TimestampVal::null();
1037 }
1038}
1039
1040TimestampVal AggregateFunctions::TimestampAvgFinalize(FunctionContext* ctx,
1041 const StringVal& src) {

Callers

nothing calls this directly

Calls 2

HasDateMethod · 0.80
ToTimestampValMethod · 0.80

Tested by

no test coverage detected