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

Function ProcessWildcardKey

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

Process wildcard(*) in value selection. path_idx is the index after the wildcard in path_str. Return next unprocessed index in path_str. Return -1 for errors.

Source from the content-addressed store, hash-verified

207/// Process wildcard(*) in value selection. path_idx is the index after the wildcard in
208/// path_str. Return next unprocessed index in path_str. Return -1 for errors.
209static int ProcessWildcardKey(FunctionContext* ctx, const StringVal& path_str,
210 int path_idx, JsonUdfValue* queue, JsonUdfAllocator* allocator) {
211 DCHECK(queue->IsArray());
212 const uint8_t* path = path_str.ptr;
213 while (path_idx < path_str.len) {
214 if (path[path_idx] == '[' || path[path_idx] == '.') break;
215 if (path[path_idx] != ' ') {
216 string msg = Substitute("Failed to parse json path '$0': "
217 "Encountered '$1' in position $2, expects ' ', '[' or '.'",
218 AnyValUtil::ToString(path_str), static_cast<char>(path[path_idx]), path_idx);
219 ctx->SetError(msg.c_str());
220 return -1;
221 }
222 ++path_idx;
223 }
224 RETURN_IF_OOM(ExtractValues(queue, allocator), -1);
225 return path_idx;
226}
227
228/// Process wildcard(*) in array selection. path_idx is the index after the wildcard in
229/// path_str. Return next unprocessed index in path_str. Return -1 for errors.

Callers 1

GetJsonObjectImplMethod · 0.85

Calls 4

SubstituteFunction · 0.85
ExtractValuesFunction · 0.70
ToStringFunction · 0.50
SetErrorMethod · 0.45

Tested by

no test coverage detected