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

Function ReportErrorBytes

be/src/exprs/string-functions-ir.cc:363–375  ·  view source on GitHub ↗

Reports the error in parsing multibyte characters with leading bytes and current locale. Used in Utf8CaseConversion().

Source from the content-addressed store, hash-verified

361/// Reports the error in parsing multibyte characters with leading bytes and current
362/// locale. Used in Utf8CaseConversion().
363static void ReportErrorBytes(FunctionContext* context, const StringVal& str,
364 int current_idx) {
365 DCHECK_LT(current_idx, str.len);
366 stringstream ss;
367 ss << "[0x" << std::hex << (int)DCHECK_NOTNULL(str.ptr)[current_idx];
368 for (int k = 1; k < 4 && current_idx + k < str.len; ++k) {
369 ss << ", 0x" << std::hex << (int)str.ptr[current_idx + k];
370 }
371 ss << "]";
372 context->AddWarning(Substitute(
373 "Illegal multi-byte character in string. Leading bytes: $0. Current locale: $1",
374 ss.str(), std::locale("").name()).c_str());
375}
376
377/// Converts string based on the transform function 'fn'. The unit of the conversion is
378/// a wchar_t (i.e. uint32_t) which is parsed from multi bytes using std::mbtowc().

Callers 1

Utf8CaseConversionFunction · 0.85

Calls 4

SubstituteFunction · 0.85
AddWarningMethod · 0.80
strMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected