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

Function GetTimezone

be/src/exprs/timestamp-functions.cc:100–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100const Timezone* GetTimezone(FunctionContext* context,
101 const StringValue& tz_string_value) {
102 void* state = context->GetFunctionState(FunctionContext::FRAGMENT_LOCAL);
103 const Timezone* timezone = reinterpret_cast<Timezone*>(state);
104 DCHECK(timezone == nullptr || context->IsArgConstant(1));
105 if (timezone == nullptr) {
106 timezone = TimezoneDatabase::FindTimezone(
107 string(tz_string_value.Ptr(), tz_string_value.Len()));
108 }
109 if (UNLIKELY(timezone == nullptr)) {
110 // Although this is an error, Hive ignores it. We will issue a warning but otherwise
111 // ignore the error too.
112 stringstream ss;
113 ss << "Unknown timezone '" << tz_string_value << "'" << endl;
114 context->AddWarning(ss.str().c_str());
115 }
116 return timezone;
117}
118
119TimestampVal TimestampFunctions::FromUtc(FunctionContext* context,
120 const TimestampVal& ts_val, const StringVal& tz_string_val) {

Callers 2

FromUtcMethod · 0.85
ToUtcMethod · 0.85

Calls 6

GetFunctionStateMethod · 0.80
IsArgConstantMethod · 0.80
AddWarningMethod · 0.80
PtrMethod · 0.45
LenMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected