| 664 | } |
| 665 | |
| 666 | Status DescriptorTbl::CreateInternal(ObjectPool* pool, const TDescriptorTable& thrift_tbl, |
| 667 | DescriptorTbl** tbl) { |
| 668 | *tbl = pool->Add(new DescriptorTbl()); |
| 669 | // deserialize table descriptors first, they are being referenced by tuple descriptors |
| 670 | for (const TTableDescriptor& tdesc: thrift_tbl.tableDescriptors) { |
| 671 | TableDescriptor* desc; |
| 672 | RETURN_IF_ERROR(CreateTblDescriptorInternal(tdesc, pool, &desc)); |
| 673 | (*tbl)->tbl_desc_map_[tdesc.id] = desc; |
| 674 | } |
| 675 | |
| 676 | for (const TTupleDescriptor& tdesc : thrift_tbl.tupleDescriptors) { |
| 677 | TupleDescriptor* desc = pool->Add(new TupleDescriptor(tdesc)); |
| 678 | // fix up table pointer |
| 679 | if (tdesc.__isset.tableId) { |
| 680 | desc->table_desc_ = (*tbl)->GetTableDescriptor(tdesc.tableId); |
| 681 | } |
| 682 | (*tbl)->tuple_desc_map_[tdesc.id] = desc; |
| 683 | } |
| 684 | |
| 685 | for (const TSlotDescriptor& tdesc : thrift_tbl.slotDescriptors) { |
| 686 | // Tuple descriptors are already populated in tbl |
| 687 | TupleDescriptor* parent = (*tbl)->GetTupleDescriptor(tdesc.parent); |
| 688 | DCHECK(parent != nullptr); |
| 689 | TupleDescriptor* children_tuple_descriptor = tdesc.__isset.itemTupleId ? |
| 690 | (*tbl)->GetTupleDescriptor(tdesc.itemTupleId) : nullptr; |
| 691 | SlotDescriptor* slot_d = pool->Add( |
| 692 | new SlotDescriptor(tdesc, parent, children_tuple_descriptor)); |
| 693 | if (slot_d->type().IsStructType() && children_tuple_descriptor != nullptr && |
| 694 | children_tuple_descriptor->getMasterTuple() == nullptr) { |
| 695 | TupleDescriptor* master_tuple = parent; |
| 696 | // If this struct is nested into other struct(s) then get the topmost tuple for the |
| 697 | // master. |
| 698 | if (parent->getMasterTuple() != nullptr) master_tuple = parent->getMasterTuple(); |
| 699 | children_tuple_descriptor->setMasterTuple(master_tuple); |
| 700 | } |
| 701 | (*tbl)->slot_desc_map_[tdesc.id] = slot_d; |
| 702 | parent->AddSlot(slot_d); |
| 703 | } |
| 704 | return Status::OK(); |
| 705 | } |
| 706 | |
| 707 | void DescriptorTbl::ReleaseResources() { |
| 708 | // close partition exprs of hdfs tables |
nothing calls this directly
no test coverage detected