| 1023 | } |
| 1024 | |
| 1025 | TimestampVal 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 | |
| 1040 | TimestampVal AggregateFunctions::TimestampAvgFinalize(FunctionContext* ctx, |
| 1041 | const StringVal& src) { |
nothing calls this directly
no test coverage detected