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

Function ParseFractionToken

be/src/runtime/datetime-parser-common.cc:185–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185bool ParseFractionToken(const char* token, int token_len,
186 DateTimeParseResult* result) {
187 DCHECK(token != nullptr);
188 DCHECK(token_len > 0);
189 DCHECK(result != nullptr);
190 StringParser::ParseResult status;
191 result->fraction =
192 StringParser::StringToInt<int32_t>(token, token_len, &status);
193 if (UNLIKELY(StringParser::PARSE_SUCCESS != status)) return false;
194 // A user may specify a time of 04:30:22.1238, the parser will return 1238 for
195 // the fractional portion. This does not represent the intended value of
196 // 123800000, therefore the number must be scaled up.
197 if (token_len < FRACTIONAL_SECOND_MAX_LENGTH) {
198 result->fraction *= std::pow(10, FRACTIONAL_SECOND_MAX_LENGTH - token_len);
199 }
200 return true;
201}
202
203int GetQuarter(int month) {
204 DCHECK(month > 0 && month <= 12);

Callers 2

ParseDateTimeMethod · 0.85
ParseDateTimeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected