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

Function ParseStringVal

be/src/exprs/string-functions.cc:288–300  ·  view source on GitHub ↗

Parse json_str into Document. Return false for errors.

Source from the content-addressed store, hash-verified

286
287/// Parse json_str into Document. Return false for errors.
288static bool ParseStringVal(FunctionContext* ctx, const StringVal& json_str,
289 JsonUdfDocument* doc) {
290 StringValStream stream(&json_str);
291 RETURN_IF_OOM(doc->ParseStream(stream), false);
292 if (doc->HasParseError()) {
293 string msg = Substitute("Failed to parse json at position $0 since: $1."
294 " Json string:\n$2", doc->GetErrorOffset(),
295 GetParseError_En(doc->GetParseError()), AnyValUtil::ToString(json_str));
296 ctx->AddWarning(msg.c_str());
297 return false;
298 }
299 return true;
300}
301
302// Initial capacity of the BFS queue used in GetJsonObjectImpl
303static const int INITIAL_QUEUE_CAPACITY = 64;

Callers 1

GetJsonObjectImplMethod · 0.85

Calls 3

SubstituteFunction · 0.85
AddWarningMethod · 0.80
ToStringFunction · 0.50

Tested by

no test coverage detected