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

Method Space

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

Source from the content-addressed store, hash-verified

151}
152
153StringVal StringFunctions::Space(FunctionContext* context, const BigIntVal& len) {
154 if (len.is_null) return StringVal::null();
155 if (len.val <= 0) return StringVal();
156 if (len.val > StringVal::MAX_LENGTH) {
157 context->SetError(Substitute(ERROR_CHARACTER_LIMIT_EXCEEDED,
158 "space() result",
159 PrettyPrinter::Print(StringVal::MAX_LENGTH, TUnit::BYTES)).c_str());
160 return StringVal::null();
161 }
162 StringVal result(context, len.val);
163 if (UNLIKELY(result.is_null)) return StringVal::null();
164 memset(result.ptr, ' ', len.val);
165 return result;
166}
167
168StringVal StringFunctions::Repeat(
169 FunctionContext* context, const StringVal& str, const BigIntVal& n) {

Callers

nothing calls this directly

Calls 3

StringValClass · 0.85
SubstituteFunction · 0.85
SetErrorMethod · 0.45

Tested by

no test coverage detected