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

Function SelectByIndex

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

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

Source from the content-addressed store, hash-verified

172// Extract all the values for 'index' where arrays in 'queue' contain that index.
173// Replace the contents of queue with the values found.
174static void SelectByIndex(const int index, JsonUdfValue* queue,
175 JsonUdfAllocator* allocator) {
176 DCHECK(queue->IsArray());
177 SizeType old_items = queue->Size();
178 for (SizeType i = 0; i < old_items; ++i) {
179 JsonUdfValue& item = (*queue)[i];
180 if (!item.IsArray() || index >= item.Capacity()) continue;
181 queue->PushBack(item[index], *allocator);
182 }
183 queue->Erase(queue->Begin(), queue->Begin() + old_items);
184}
185
186// Expand all arrays in the queue and replace the contents of queue with them.
187static void ExpandArrays(JsonUdfValue* queue, JsonUdfAllocator* allocator) {

Callers 1

ProcessNumberIndexFunction · 0.85

Calls 5

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

Tested by

no test coverage detected