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

Function SelectByKey

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

Extract all the values for 'key' where objects in 'queue' contain that key. Replace the contents of queue with the values found.

Source from the content-addressed store, hash-verified

158// Extract all the values for 'key' where objects in 'queue' contain that key.
159// Replace the contents of queue with the values found.
160static void SelectByKey(const string& key, JsonUdfValue* queue,
161 JsonUdfAllocator* allocator) {
162 SizeType old_items = queue->Size(); // RapidJson uses SizeType instead of size_t
163 JsonUdfValue item;
164 for (SizeType i = 0; i < old_items; ++i) {
165 item = (*queue)[i];
166 if (!item.IsObject() || !item.HasMember(key)) continue;
167 queue->PushBack(item[key], *allocator);
168 }
169 queue->Erase(queue->Begin(), queue->Begin() + old_items);
170}
171
172// Extract all the values for 'index' where arrays in 'queue' contain that index.
173// Replace the contents of queue with the values found.

Callers 1

GetJsonObjectImplMethod · 0.85

Calls 4

PushBackMethod · 0.80
SizeMethod · 0.45
EraseMethod · 0.45
BeginMethod · 0.45

Tested by

no test coverage detected