| 98 | } |
| 99 | |
| 100 | const 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 | |
| 119 | TimestampVal TimestampFunctions::FromUtc(FunctionContext* context, |
| 120 | const TimestampVal& ts_val, const StringVal& tz_string_val) { |
no test coverage detected