const NodeInfo PNode :: GetMaster(const int iGroupIdx) { if (!CheckGroupID(iGroupIdx)) { return NodeInfo(nullnode); } return NodeInfo(m_vecMasterList[iGroupIdx]->GetMasterSM()->GetMaster()); }
const NodeInfo PNode :: GetMasterWithVersion(const int iGroupIdx, uint64_t & llVersion) { if (!CheckGroupID(iGroupIdx)) { return NodeInfo(nullnode); } return NodeInfo(m_vecMasterList[iGroupIdx]->GetMasterSM()->GetMasterWithVersion(llVersion)); }
TreeNode *buildTree(vector<int> &preorder, vector<int> &inorder) { // Start typing your C/C++ solution below // DO NOT write int main() function TreeNode *head; if(preorder.size()==0) return NULL; head=new TreeNode(preorder[0]); if(preorder.size()==1) return head; queue<NodeInfo> niq; niq.push(NodeInfo(head,0,preorder.size()-1,0,inorder.size()-1)); int nodeidx_in,start_pre,end_pre,start_in,end_in; while(!niq.empty()){ if(niq.front().start_pre<niq.front().end_pre){ nodeidx_in=findelement(inorder,niq.front().start_in,niq.front().end_in,preorder[niq.front().start_pre]); if(niq.front().start_in<nodeidx_in){ //left substree exists start_pre=niq.front().start_pre+1; start_in=niq.front().start_in; end_pre=start_pre; while( end_pre<=niq.front().end_pre && nodeidx_in>findelement(inorder,niq.front().start_in,niq.front().end_in,preorder[end_pre]) ) end_pre++; end_in=nodeidx_in-1; niq.front().root->left=new TreeNode(preorder[start_pre]); niq.push(NodeInfo(niq.front().root->left,start_pre,end_pre-1,start_in,end_in)); if(nodeidx_in<niq.front().end_in){ //right substree exists start_pre=end_pre; end_pre=niq.front().end_pre; start_in=nodeidx_in+1; end_in=niq.front().end_in; niq.front().root->right=new TreeNode(preorder[start_pre]); niq.push(NodeInfo(niq.front().root->right,start_pre,end_pre,start_in,end_in)); } } else{ //only right substree start_pre=niq.front().start_pre+1; end_pre=niq.front().end_pre; start_in=niq.front().start_in+1; end_in=niq.front().end_in; niq.front().root->right=new TreeNode(preorder[start_pre]); niq.push(NodeInfo(niq.front().root->right,start_pre,end_pre,start_in,end_in)); } } niq.pop(); } return head; }
void MakeConfig(MockLogStorage * poMockLogStorage, Config *& poConfig) { string sIP = "127.0.0.1"; int iPort = 11111; NodeInfo oMyNode(sIP, iPort); NodeInfoList vecNodeInfoList; for (int i = 0; i < 3; i++) { vecNodeInfoList.push_back(NodeInfo(sIP, iPort)); iPort++; } FollowerNodeInfoList vecFollowerNodeInfoList; int iMyGroupIdx = 0; int iGroupCount = 1; poConfig = nullptr; poConfig = new Config(poMockLogStorage, true, 0, false, oMyNode, vecNodeInfoList, vecFollowerNodeInfoList, iMyGroupIdx, iGroupCount, nullptr); assert(poConfig != nullptr); EXPECT_CALL(*poMockLogStorage, GetSystemVariables(_,_)).Times(1).WillOnce(Return(1)); poConfig->Init(); }
unsigned CHartUpMsgQueue::Enque( ProtocolPacketPtr& p_pElm , unsigned p_nHandle) { // LOG( "%s MsgQ.Enque [Try enque] (Handle:x%04X Capacity:%u Qsz:%u)", m_szName // , p_nHandle // , m_nCapacity // , m_prgBucket.size() // ); // Test Queue Overflow if ( m_prgBucket.size() >= m_nCapacity ) { // m_bHasGaps = true ; // Shrink() ; // if ( m_nInsertPos >= m_nCapacity ) // { LOG( "%s MsgQ.Enque [Message discarded:queue full] (Handle:x%04X Capacity:%u Qsz:%u)", m_szName , p_nHandle , m_nCapacity , m_prgBucket.size() ); return 0 ; // } } // already inserted for (NodeInfoPtrList::iterator it = m_prgBucket.begin(); it != m_prgBucket.end(); ++it) // for ( unsigned i=0; i<m_nInsertPos; ++i ) { if ( it->m_nHandle == p_nHandle ) { it->m_nRetries ++ ; LOG( "%s MsgQ.Enque [Handle already in queue] (Handle:x%04X Capacity:%u Qsz:%u)", m_szName , p_nHandle , m_nCapacity , m_prgBucket.size() ) ; return p_nHandle ; } } // first insertion m_prgBucket.push_back(NodeInfo()); NodeInfo& node = m_prgBucket.back(); node.pkt = p_pElm ; node.m_nPktLifeTime = 0 ; node.m_nNextSendTimestamp = 0 ; node.m_nRetries = 0 ; node.m_nHandle = p_nHandle ; node.toBeErased = false; LOG( "%s MsqQ.Enque [Enque done] (Handle:x%04X Capacity:%u Qsz:%u)", m_szName , node.m_nHandle , m_prgBucket.capacity() , m_prgBucket.size() ) ; return node.m_nHandle ; }
//------------------------------------------------------------------------------ void XMLTreeWriter::Write () { OpenTree(); cur = t->GetRoot(); count = 0; while (cur) { if (cur->GetChild()) { count++; OpenNode(); NodeInfo(); stk.push (cur); cur = cur->GetChild(); } else { count++; OpenNode(); NodeInfo(); CloseNode(); while (!stk.empty() && (cur->GetSibling() == NULL)) { CloseNode(); cur = stk.top(); stk.pop(); } if (stk.empty()) cur = NULL; else { cur = cur->GetSibling(); } } } CloseTree(); }
void ClusterMembership::decodePacket(const char *buf, int len, const IpAddress & src) { // Check length acceptable if (len < 20) return; // Check magic number unsigned int magic = ntohl(* (unsigned int *) buf); if (magic != MagicNumber) return; CommandType cmd = (CommandType) ntohl(* (unsigned int *) (buf + 12)); // See if it's a "set weight" packet if (cmd == CommandSetWeight) { handleSetWeight(buf, len, src); return; } // Otherwise, it's a normal multicast pkt. // Check cluster IP IpAddress decode_clusteraddr; decode_clusteraddr.copyFromInAddr((struct in_addr *) (buf+4)); if (decode_clusteraddr != clusteraddr) return; // Get source addr in packet, ensure it's the same as // the sender. IpAddress decode_src; decode_src.copyFromInAddr((struct in_addr *) (buf+8)); if (decode_src != src) return; unsigned int weight = ntohl(*(int *) (buf + 16)); // Ignore messages from my own node. if (src == localaddr) return; switch (cmd) { case CommandStatus: case CommandMaster: // ok; break; default: // unknown cmd return; } // std::cout << "From " << src << " Command:" << cmd << " node weight:" << weight << std::endl; // Check if it's already in nodemap. if (nodes.find(src) == nodes.end()) { nodes[src] = NodeInfo(); } // Update weight and timestamp. nodes[src].weight = weight; if (! nodes[src].isup) { nodes[src].isup = true; std::cout << "Node up:" << src << std::endl; } // Timestamp gettimeofday(& (nodes[src].lastheard), 0); if (cmd == CommandMaster) { decodeMasterPacket(buf,len,src); } }
void nsXMLProcessingInstruction::List(FILE* out, PRInt32 aIndent) const { PRInt32 index; for (index = aIndent; --index >= 0; ) fputs(" ", out); fprintf(out, "Processing instruction refcount=%d<", mRefCnt.get()); nsAutoString tmp; ToCString(tmp, 0, mText.GetLength()); tmp.Insert(nsDependentAtomString(NodeInfo()->GetExtraName()).get(), 0); fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out); fputs(">\n", out); }
bool RPCServer::processRequest() { NodeId senderId; Message message; const bool result = socket_.receive(senderId, message); if (!result) { return false; } if (message.routineState != STATE_0) { // Not a request. return false; } if (!message.subnetwork || *(message.subnetwork) != NetworkId::Generate("p2p.rootdht")) { // Response is not for this subnetwork. return false; } switch (message.type) { case RPCMessage::GET_NEAREST_NODES: { const auto targetId = readNodeId(message.payload); auto nodeInfoList = delegate_.getNearestNodes(targetId); const auto sendMessage = RPCMessage::GetNearestNodesReply(std::move(nodeInfoList)).createMessage(message.routine); socket_.send(senderId, sendMessage); return true; } case RPCMessage::SUBSCRIBE: { auto subscribePair = readSubscribe(message.payload); delegate_.subscribe(subscribePair.first, NodeInfo(senderId, std::move(subscribePair.second))); const auto sendMessage = RPCMessage::SubscribeReply().createMessage(message.routine); socket_.send(senderId, sendMessage); return true; } case RPCMessage::GET_SUBSCRIBERS: { const auto targetId = readNodeId(message.payload); auto nodeInfoList = delegate_.getSubscribers(targetId); const auto sendMessage = RPCMessage::GetSubscribersReply(std::move(nodeInfoList)).createMessage(message.routine); socket_.send(senderId, sendMessage); return true; } default: return false; } }
ClusterMembership::ClusterMembership(const IpAddress &bindaddr, const IpAddress &clusteraddr, int ifindex) { // Set qhand to null initially qhand = 0; // Open multicast socket... sock = makesock(bindaddr); // Join multicast group(s) multisetup(sock, bindaddr, ifindex); // Make it nonblocking. SetNonBlocking(sock); this->clusteraddr = clusteraddr; this->localaddr = bindaddr; // Record the startup time gettimeofday(& starttime, 0); effectiveWeight = 0; // Add our own host to "nodes" nodes[bindaddr] = NodeInfo(); nodes[bindaddr].isme = true; nodes[bindaddr].isup = true; nodes[bindaddr].weight = effectiveWeight; }
bool NetworkPlan::parse(vector<char*> lines, vector<NodeInfo>& nodes) { const int bufSize = 128; char* chBuf = new char[bufSize]; vector<NumLen> outLinks; vector<string> tokens; _Tcrit = 0; _layers = new vector<vector<NetworkNode*>*>(); _critPaths = new vector<vector<NetworkNode*>*>(); // Добавляем вектор для первого критического пути. _critPaths->push_back(new vector<NetworkNode*>()); int size = lines.size(); // Считывание описания сети~ for (int i = 0; i < size; i++) { istringstream* iss = new istringstream(lines.at(i)); copy(istream_iterator<string>(*iss), istream_iterator<string>(), back_inserter<vector<string>>(tokens)); outLinks.clear(); delete iss; int tmpNum = 0; for (unsigned int i = 0; i < tokens.size(); i++) { int tmpNum2 = 0; int j = 0; double tmpLength = 0; if (i == 0) tmpNum = atoi(tokens.at(i).c_str()); else { iss = new istringstream(tokens.at(i)); j = 0; while (iss->getline(chBuf, bufSize, ',')) { string* strBuf = new string(chBuf); if (j++ == 0) tmpNum2 = atoi(strBuf->substr(1, strBuf->length() - 1).c_str()); else tmpLength = atof(strBuf->substr(0, strBuf->length() - 1).c_str()); delete strBuf; } delete iss; outLinks.push_back(NumLen(tmpNum2, tmpLength)); } } nodes.push_back(NodeInfo(new NetworkNode(tmpNum), outLinks)); tokens.clear(); } //~ delete[] chBuf; return true; }
int MasterStateMachine :: UpdateByCheckpoint(const std::string & sCPBuffer, bool & bChange) { if (sCPBuffer.size() == 0) { return 0; } MasterVariables oVariables; bool bSucc = oVariables.ParseFromArray(sCPBuffer.data(), sCPBuffer.size()); if (!bSucc) { PLG1Err("Variables.ParseFromArray fail, bufferlen %zu", sCPBuffer.size()); return -1; } std::lock_guard<std::mutex> oLockGuard(m_oMutex); if (oVariables.version() <= m_llMasterVersion && m_llMasterVersion != (uint64_t)-1) { PLG1Imp("lag checkpoint, no need update, cp.version %lu now.version %lu", oVariables.version(), m_llMasterVersion); return 0; } int ret = UpdateMasterToStore(oVariables.masternodeid(), oVariables.version(), oVariables.leasetime()); if (ret != 0) { return -1; } PLG1Head("ok, cp.version %lu cp.masternodeid %lu old.version %lu old.masternodeid %lu", oVariables.version(), oVariables.masternodeid(), m_llMasterVersion, m_iMasterNodeID); bool bMasterChange = false; m_llMasterVersion = oVariables.version(); if (oVariables.masternodeid() == m_iMyNodeID) { m_iMasterNodeID = nullnode; m_llAbsExpireTime = 0; } else { if (m_iMasterNodeID != oVariables.masternodeid()) { bMasterChange = true; } m_iMasterNodeID = oVariables.masternodeid(); m_llAbsExpireTime = Time::GetSteadyClockMS() + oVariables.leasetime(); } if (bMasterChange) { if (m_pMasterChangeCallback != nullptr) { m_pMasterChangeCallback(m_iMyGroupIdx, NodeInfo(m_iMasterNodeID), m_llMasterVersion); } } return 0; }
int MasterStateMachine :: LearnMaster( const uint64_t llInstanceID, const MasterOperator & oMasterOper, const uint64_t llAbsMasterTimeout) { std::lock_guard<std::mutex> oLockGuard(m_oMutex); PLG1Debug("my last version %lu other last version %lu this version %lu instanceid %lu", m_llMasterVersion, oMasterOper.lastversion(), oMasterOper.version(), llInstanceID); if (oMasterOper.lastversion() != 0 && llInstanceID > m_llMasterVersion && oMasterOper.lastversion() != m_llMasterVersion) { BP->GetMasterBP()->MasterSMInconsistent(); PLG1Err("other last version %lu not same to my last version %lu, instanceid %lu", oMasterOper.lastversion(), m_llMasterVersion, llInstanceID); PLG1Err("try to fix, set my master version %lu as other last version %lu, instanceid %lu", m_llMasterVersion, oMasterOper.lastversion(), llInstanceID); m_llMasterVersion = oMasterOper.lastversion(); } if (oMasterOper.version() != m_llMasterVersion) { PLG1Debug("version conflit, op version %lu now master version %lu", oMasterOper.version(), m_llMasterVersion); return 0; } int ret = UpdateMasterToStore(oMasterOper.nodeid(), llInstanceID, oMasterOper.timeout()); if (ret != 0) { PLG1Err("UpdateMasterToStore fail, ret %d", ret); return -1; } bool bMasterChange = false; if (m_iMasterNodeID != oMasterOper.nodeid()) { bMasterChange = true; } m_iMasterNodeID = oMasterOper.nodeid(); if (m_iMasterNodeID == m_iMyNodeID) { //self be master //use local abstimeout m_llAbsExpireTime = llAbsMasterTimeout; BP->GetMasterBP()->SuccessBeMaster(); PLG1Head("Be master success, absexpiretime %lu", m_llAbsExpireTime); } else { //other be master //use new start timeout m_llAbsExpireTime = Time::GetSteadyClockMS() + oMasterOper.timeout(); BP->GetMasterBP()->OtherBeMaster(); PLG1Head("Ohter be master, absexpiretime %lu", m_llAbsExpireTime); } m_iLeaseTime = oMasterOper.timeout(); m_llMasterVersion = llInstanceID; if (bMasterChange) { if (m_pMasterChangeCallback != nullptr) { m_pMasterChangeCallback(m_iMyGroupIdx, NodeInfo(m_iMasterNodeID), m_llMasterVersion); } } PLG1Imp("OK, masternodeid %lu version %lu abstimeout %lu", m_iMasterNodeID, m_llMasterVersion, m_llAbsExpireTime); return 0; }
void NetworkView::updateDisplay() { if(!isVisible()) return ; if(!_should_update) return ; /* add all friends */ std::string ownGPGId = rsPeers->getGPGOwnId(); //#ifdef DEBUG_NETWORKVIEW std::cerr << "NetworkView::updateDisplay()" << std::endl; //#endif std::deque<NodeInfo> nodes_to_treat ; // list of nodes to be treated. Used as a queue. The int is the level of friendness std::set<std::string> nodes_considered ; // list of nodes already considered. Eases lookup. nodes_to_treat.push_front(NodeInfo(ownGPGId,0)) ; // initialize queue with own id. nodes_considered.insert(rsPeers->getOwnId()) ; // Put own id in queue, and empty the queue, treating all nodes. // while(!nodes_to_treat.empty()) { NodeInfo info(nodes_to_treat.back()) ; nodes_to_treat.pop_back() ; #ifdef DEBUG_NETWORKVIEW std::cerr << " Poped out of queue: " << info.gpg_id << ", with level " << info.friend_level << std::endl ; #endif GraphWidget::NodeType type ; GraphWidget::AuthType auth ; switch(info.friend_level) { case 0: type = GraphWidget::ELASTIC_NODE_TYPE_OWN ; break ; case 1: type = GraphWidget::ELASTIC_NODE_TYPE_FRIEND ; break ; case 2: type = GraphWidget::ELASTIC_NODE_TYPE_F_OF_F ; break ; default: type = GraphWidget::ELASTIC_NODE_TYPE_UNKNOWN ; } RsPeerDetails detail ; if(!rsPeers->getPeerDetails(info.gpg_id, detail)) continue ; switch(detail.trustLvl) { case RS_TRUST_LVL_MARGINAL: auth = GraphWidget::ELASTIC_NODE_AUTH_MARGINAL ; break; case RS_TRUST_LVL_FULL: case RS_TRUST_LVL_ULTIMATE: auth = GraphWidget::ELASTIC_NODE_AUTH_FULL ; break; case RS_TRUST_LVL_UNKNOWN: case RS_TRUST_LVL_UNDEFINED: case RS_TRUST_LVL_NEVER: default: auth = GraphWidget::ELASTIC_NODE_AUTH_UNKNOWN ; break ; } if(info.friend_level <= _max_friend_level && _node_ids.find(info.gpg_id) == _node_ids.end()) { _node_ids[info.gpg_id] = ui.graphicsView->addNode(" "+detail.name, detail.name+"@"+detail.gpg_id,type,auth,"",info.gpg_id); #ifdef DEBUG_NETWORKVIEW std::cerr << " inserted node " << info.gpg_id << ", type=" << type << ", auth=" << auth << std::endl ; #endif } std::list<std::string> friendList; rsDisc->getDiscGPGFriends(info.gpg_id, friendList); #ifdef DEBUG_NETWORKVIEW std::cerr << " Got a list of " << friendList.size() << " friends for this peer." << std::endl ; #endif if(info.friend_level+1 <= _max_friend_level) for(std::list<std::string>::const_iterator sit(friendList.begin()); sit != friendList.end(); ++sit) if(nodes_considered.find(*sit) == nodes_considered.end()) { #ifdef DEBUG_NETWORKVIEW std::cerr << " adding to queue: " << *sit << ", with level " << info.friend_level+1 << std::endl ; #endif nodes_to_treat.push_front( NodeInfo(*sit,info.friend_level + 1) ) ; nodes_considered.insert(*sit) ; } } /* iterate through all friends */ #ifdef DEBUG_NETWORKVIEW std::cerr << "NetworkView::insertSignatures()" << std::endl; #endif for(std::map<std::string,GraphWidget::NodeId>::const_iterator it(_node_ids.begin()); it != _node_ids.end(); it++) { std::list<std::string> friendList ; if(rsDisc->getDiscGPGFriends(it->first,friendList)) for(std::list<std::string>::const_iterator sit(friendList.begin()); sit != friendList.end(); sit++) { #ifdef DEBUG_NETWORKVIEW std::cerr << "NetworkView: Adding Edge: "; std::cerr << *sit << " <-> " << it->first; std::cerr << std::endl; #endif if(_node_ids.find(*sit) != _node_ids.end()) ui.graphicsView->addEdge(_node_ids[*sit], it->second); } } _should_update = false ; }
void Rating_CoSKQ_Query(int StartNode, std::vector<KeyWord> KSet, std::pair<int, int> Cuslimit) { result = new std::vector<int>(); desire = new std::vector<int>(); invertList = new std::vector<std::vector<NodeInfo>>(KSet.size(), std::vector<NodeInfo>()); OptRating = 0; CurrentRating = 0; //construct inverted list in D(NodeID, MaxDist) int count = 0; bool only = true; //test StartNode whether it has keywords belong to KSet ` for (std::vector<KeyWord>::iterator itr = KSet.begin(); only && itr != KSet.end(); ++itr, ++count) { if (NodeKW[StartNode] & *itr) { //relevant with KSet (*invertList)[count].push_back(NodeInfo(StartNode, NodeRating[StartNode])); only = false; } } //test Other Node for (int i = 0; i < MAX_NODE_NUM; ++i) { if (SDist[StartNode][i] && SDist[StartNode][i] <= Cuslimit.first) { count = 0; only = true; for (std::vector<KeyWord>::iterator itr = KSet.begin(); only && itr != KSet.end(); ++itr, ++count) { if (NodeKW[i] & *itr) { (*invertList)[count].push_back(NodeInfo(i, NodeRating[i])); only = false; } } } } bool cover = true; //test whether cover the keyword set for (std::vector<std::vector<NodeInfo>>::iterator itrK = (*invertList).begin(); cover && itrK != (*invertList).end(); ++itrK) { if (itrK->empty()) { cover = false; } } if (cover) { //sorted inverted list rank with the rating score for (std::vector<std::vector<NodeInfo>>::iterator itrK = (*invertList).begin(); itrK != (*invertList).end(); ++itrK) { std::sort((*itrK).begin(), (*itrK).end()); } //construct SMax count = KSet.size() - 1; int sum = 0; for (std::vector<std::vector<NodeInfo>>::reverse_iterator ritrK = invertList->rbegin(); ritrK != invertList->rend(); ++ritrK) { sum += ((ritrK->begin()))->mRating; SMax[count--] = sum; } //find a feasible set findOptimalSolution(0, KSet.size(), Cuslimit.second); } //Output result //outputStatistic("Result\\TestResult.txt", OptRating); outputNodeList("Result\\TestResult.txt"); delete invertList; delete desire; delete result; }
void PlanVisualizer::visit(const P::PhysicalPtr &input) { int node_id = ++id_counter_; node_id_map_.emplace(input, node_id); std::set<E::ExprId> referenced_ids; for (const auto &attr : input->getReferencedAttributes()) { referenced_ids.emplace(attr->id()); } for (const auto &child : input->children()) { visit(child); int child_id = node_id_map_[child]; edges_.emplace_back(EdgeInfo()); EdgeInfo &edge_info = edges_.back(); edge_info.src_node_id = child_id; edge_info.dst_node_id = node_id; edge_info.dashed = false; if ((input->getPhysicalType() == P::PhysicalType::kHashJoin || input->getPhysicalType() == P::PhysicalType::kFilterJoin) && child == input->children()[1]) { edge_info.dashed = true; } for (const auto &attr : child->getOutputAttributes()) { if (referenced_ids.find(attr->id()) != referenced_ids.end()) { edge_info.labels.emplace_back(attr->attribute_alias()); } } } nodes_.emplace_back(NodeInfo()); NodeInfo &node_info = nodes_.back(); node_info.id = node_id; if (color_map_.find(input->getName()) != color_map_.end()) { node_info.color = color_map_[input->getName()]; } switch (input->getPhysicalType()) { case P::PhysicalType::kTableReference: { const P::TableReferencePtr table_reference = std::static_pointer_cast<const P::TableReference>(input); node_info.labels.emplace_back(table_reference->relation()->getName()); break; } case P::PhysicalType::kHashJoin: { const P::HashJoinPtr hash_join = std::static_pointer_cast<const P::HashJoin>(input); node_info.labels.emplace_back(input->getName()); const auto &left_attributes = hash_join->left_join_attributes(); const auto &right_attributes = hash_join->right_join_attributes(); for (std::size_t i = 0; i < left_attributes.size(); ++i) { node_info.labels.emplace_back( left_attributes[i]->attribute_alias() + " = " + right_attributes[i]->attribute_alias()); } break; } case P::PhysicalType::kFilterJoin: { const P::FilterJoinPtr filter_join = std::static_pointer_cast<const P::FilterJoin>(input); node_info.labels.emplace_back(input->getName()); const auto &probe_attributes = filter_join->probe_attributes(); const auto &build_attributes = filter_join->build_attributes(); for (std::size_t i = 0; i < probe_attributes.size(); ++i) { node_info.labels.emplace_back( probe_attributes[i]->attribute_alias() + " = " + build_attributes[i]->attribute_alias()); } break; } default: { node_info.labels.emplace_back(input->getName()); break; } } const P::PartitionSchemeHeader *partition_scheme_header = input->getOutputPartitionSchemeHeader(); if (partition_scheme_header) { node_info.labels.emplace_back(partition_scheme_header->toString()); } if (lip_filter_conf_ != nullptr) { const auto &build_filters = lip_filter_conf_->getBuildInfoMap(); const auto build_it = build_filters.find(input); if (build_it != build_filters.end()) { for (const auto &build_info : build_it->second) { node_info.labels.emplace_back( std::string("[LIP build] ") + build_info->build_attribute()->attribute_alias()); } } const auto &probe_filters = lip_filter_conf_->getProbeInfoMap(); const auto probe_it = probe_filters.find(input); if (probe_it != probe_filters.end()) { for (const auto &probe_info : probe_it->second) { node_info.labels.emplace_back( std::string("[LIP probe] ") + probe_info->probe_attribute()->attribute_alias()); } } } try { const std::size_t estimated_cardinality = cost_model_->estimateCardinality(input); const double estimated_selectivity = cost_model_->estimateSelectivity(input); node_info.labels.emplace_back( "est. # = " + std::to_string(estimated_cardinality)); node_info.labels.emplace_back( "est. Selectivity = " + std::to_string(estimated_selectivity)); } catch (const std::exception &e) { // NOTE(jianqiao): CostModel::estimateCardinality() may throw UnsupportedPhysicalPlan // exception for some type of physical nodes such as CreateTable. // In this case, we omit the node's cardinality/selectivity information. } }