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

Method CollectNonNullNonSmallVarSlotsHelper

be/src/runtime/sorter.cc:630–666  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

628}
629
630void Sorter::Run::CollectNonNullNonSmallVarSlotsHelper(Tuple* src,
631 const TupleDescriptor& tuple_desc, vector<StringValue*>* string_values,
632 std::vector<std::pair<CollectionValue*, int64_t>>* collection_values,
633 int* total_var_len) {
634 for (const SlotDescriptor* string_slot: tuple_desc.string_slots()) {
635 if (!src->IsNull(string_slot->null_indicator_offset())) {
636 StringValue* string_val =
637 reinterpret_cast<StringValue*>(src->GetSlot(string_slot->tuple_offset()));
638 if (string_val->IsSmall()) continue;
639 string_values->push_back(string_val);
640 *total_var_len += string_val->Len();
641 }
642 }
643
644 for (const SlotDescriptor* collection_slot: tuple_desc.collection_slots()) {
645 if (!src->IsNull(collection_slot->null_indicator_offset())) {
646 CollectionValue* collection_value = reinterpret_cast<CollectionValue*>(
647 src->GetSlot(collection_slot->tuple_offset()));
648 const TupleDescriptor& child_tuple_desc =
649 *collection_slot->children_tuple_descriptor();
650
651 int64_t byte_size = collection_value->ByteSize(child_tuple_desc);
652 *total_var_len += byte_size;
653
654 // Recurse first so that children come before parents in the list. See the function
655 // comment in the header for the reason.
656 for (int i = 0; i < collection_value->num_tuples; i++) {
657 Tuple* child_tuple = reinterpret_cast<Tuple*>(
658 collection_value->ptr + i * child_tuple_desc.byte_size());
659 CollectNonNullNonSmallVarSlotsHelper(child_tuple, child_tuple_desc, string_values,
660 collection_values, total_var_len);
661 }
662
663 collection_values->push_back(make_pair(collection_value, byte_size));
664 }
665 }
666}
667
668Status Sorter::Run::TryAddPage(
669 AddPageMode mode, vector<Page>* page_sequence, bool* added) {

Callers

nothing calls this directly

Calls 9

tuple_offsetMethod · 0.80
push_backMethod · 0.80
IsNullMethod · 0.45
GetSlotMethod · 0.45
IsSmallMethod · 0.45
LenMethod · 0.45
ByteSizeMethod · 0.45
byte_sizeMethod · 0.45

Tested by

no test coverage detected