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

Method FormatDefault

be/src/runtime/date-parse-util.cc:134–147  ·  view source on GitHub ↗

Formats date into dst using the default format Format: yyyy-MM-dd Offsets: 0123456789

Source from the content-addressed store, hash-verified

132// Format: yyyy-MM-dd
133// Offsets: 0123456789
134int DateParser::FormatDefault(const DateValue& date, char* dst) {
135 int year, month, day;
136 if (!date.ToYearMonthDay(&year, &month, &day)) {
137 *dst = '\0';
138 return -1;
139 }
140 else {
141 ZeroPad(dst, year, 4);
142 ZeroPad(dst + 5, month, 2);
143 ZeroPad(dst + 8, day, 2);
144 dst[7] = dst[4] = '-';
145 return SimpleDateFormatTokenizer::DEFAULT_DATE_FMT_LEN;
146 }
147}
148
149string DateParser::Format(const DateTimeFormatContext& dt_ctx, const DateValue& date) {
150 DCHECK(dt_ctx.toks.size() > 0);

Callers

nothing calls this directly

Calls 2

ZeroPadFunction · 0.85
ToYearMonthDayMethod · 0.80

Tested by

no test coverage detected