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

Method CreateInternal

be/src/runtime/descriptors.cc:666–705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

664}
665
666Status 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
707void DescriptorTbl::ReleaseResources() {
708 // close partition exprs of hdfs tables

Callers

nothing calls this directly

Calls 9

OKFunction · 0.85
GetTableDescriptorMethod · 0.80
GetTupleDescriptorMethod · 0.80
IsStructTypeMethod · 0.80
getMasterTupleMethod · 0.80
setMasterTupleMethod · 0.80
AddSlotMethod · 0.80
AddMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected