| 628 | } |
| 629 | |
| 630 | void 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 | |
| 668 | Status Sorter::Run::TryAddPage( |
| 669 | AddPageMode mode, vector<Page>* page_sequence, bool* added) { |
nothing calls this directly
no test coverage detected