| 506 | CAST_TO_TIMESTAMP(BigIntVal); |
| 507 | |
| 508 | TimestampVal CastFunctions::CastToTimestampVal(FunctionContext* ctx, |
| 509 | const StringVal& val) { |
| 510 | DCHECK(ctx != nullptr); |
| 511 | if (val.is_null) return TimestampVal::null(); |
| 512 | const DateTimeFormatContext* format_ctx = |
| 513 | reinterpret_cast<const DateTimeFormatContext*>( |
| 514 | ctx->GetFunctionState(FunctionContext::FRAGMENT_LOCAL)); |
| 515 | TimestampValue tv; |
| 516 | if (format_ctx != nullptr) { |
| 517 | tv = TimestampValue::ParseIsoSqlFormat(reinterpret_cast<const char*>(val.ptr), |
| 518 | val.len, *format_ctx); |
| 519 | } else { |
| 520 | tv = TimestampValue::ParseSimpleDateFormat(reinterpret_cast<const char*>(val.ptr), |
| 521 | val.len); |
| 522 | } |
| 523 | TimestampVal result; |
| 524 | tv.ToTimestampVal(&result); |
| 525 | return result; |
| 526 | } |
| 527 | |
| 528 | TimestampVal CastFunctions::CastToTimestampVal(FunctionContext* ctx, const DateVal& val) { |
| 529 | if (val.is_null) return TimestampVal::null(); |
nothing calls this directly
no test coverage detected