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

Method StringValFromTimestamp

be/src/exprs/timestamp-functions-ir.cc:61–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59using namespace datetime_parse_util;
60
61StringVal TimestampFunctions::StringValFromTimestamp(FunctionContext* context,
62 const TimestampValue& tv, const StringVal& fmt) {
63 void* state = context->GetFunctionState(FunctionContext::THREAD_LOCAL);
64 DateTimeFormatContext* dt_ctx = reinterpret_cast<DateTimeFormatContext*>(state);
65 if (!context->IsArgConstant(1)) {
66 dt_ctx->Reset(reinterpret_cast<const char*>(fmt.ptr), fmt.len);
67 if (!SimpleDateFormatTokenizer::Tokenize(dt_ctx, FORMAT)){
68 ReportBadFormat(context, datetime_parse_util::GENERAL_ERROR, fmt, false);
69 return StringVal::null();
70 }
71 }
72
73 return tv.ToStringVal(context, *dt_ctx);
74}
75
76template <class TIME>
77StringVal TimestampFunctions::FromUnix(FunctionContext* context, const TIME& intp) {

Callers

nothing calls this directly

Calls 5

ReportBadFormatFunction · 0.85
GetFunctionStateMethod · 0.80
IsArgConstantMethod · 0.80
ResetMethod · 0.45
ToStringValMethod · 0.45

Tested by

no test coverage detected