MCPcopy Create free account
hub / github.com/apache/cloudberry / foreach_with_count

Function foreach_with_count

src/backend/gpopt/utils/COptTasks.cpp:606–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

604 ListCell *l;
605 int count = 0;
606 foreach_with_count(l, relations, count)
607 {
608 char *relation = (char *) lfirst(l);
609 if (aliases.count(std::string(relation)) > 0)
610 {
611 pair->Release();
612 // invalid leading hint if alias is specified more than once
613 return nullptr;
614 }
615 aliases.insert(std::string(relation));
616
617 CWStringConst *alias = GPOS_NEW(mp) CWStringConst(mp, relation);
618
619 if (count == 0)
620 {
621 // As we traverse the input list relations, we build up the
622 // JoinNode pair. The first element is an edge case because there
623 // is no existing JoinNode pair yet.
624 pair = GPOS_NEW(mp) CJoinHint::JoinNode(alias);
625 }
626 else
627 {
628 pair = GPOS_NEW(mp) CJoinHint::JoinNode(
629 pair, GPOS_NEW(mp) CJoinHint::JoinNode(alias),
630 /*is_directed*/ false);
631 }
632 }
633
634 return pair;
635}

Callers 15

readRegisterMessageFunction · 0.85
buildGangDefinitionFunction · 0.85
execMotionSortedReceiverFunction · 0.85
ExecInitDynamicSeqScanFunction · 0.85
ExecDynamicSeqScanFunction · 0.85
ExecInitDynamicIndexScanFunction · 0.85
ExecDynamicIndexScanFunction · 0.85
ExecDynamicForeignScanFunction · 0.85

Calls 4

JoinNodeClass · 0.85
countMethod · 0.80
CWStringConstClass · 0.50
ReleaseMethod · 0.45

Tested by 2

GetPossibleValuesAsArrayFunction · 0.68
project_describeFunction · 0.68