MCPcopy Create free account
hub / github.com/ByConity/ByConity / visitJoinNode

Method visitJoinNode

src/QueryPlan/Hints/ImplementJoinOperationHints.cpp:26–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26void JoinOperationHintsVisitor::visitJoinNode(JoinNode & node, Void & v)
27{
28 visitPlanNode(node, v);
29
30 TableScanHintVisitor visitor;
31 TableScanContext left_scan_context;
32 TableScanContext right_scan_context;
33
34 VisitorUtil::accept(node.getChildren()[0], visitor, left_scan_context);
35 VisitorUtil::accept(node.getChildren()[1], visitor, right_scan_context);
36
37 if (left_scan_context.hint_list.empty() && right_scan_context.hint_list.empty())
38 return;
39
40 PlanHintPtr left_hint;
41 // If there are multiple JOIN_OPERATION hints, only the first one needs to be considered
42 for (auto & hint : left_scan_context.hint_list)
43 {
44 if (hint->getType() == HintCategory::DISTRIBUTION_TYPE)
45 {
46 left_hint = hint;
47 break;
48 }
49 }
50
51 PlanHintPtr right_hint;
52 // If there are multiple JOIN_OPERATION hints, only the first one needs to be considered
53 for (auto & hint : right_scan_context.hint_list)
54 {
55 if (hint->getType() == HintCategory::DISTRIBUTION_TYPE)
56 {
57 right_hint = hint;
58 break;
59 }
60 }
61
62 if (left_hint == nullptr && right_hint == nullptr)
63 return ;
64
65 const auto & step = *node.getStep();
66 if (step.mustRepartition())
67 return;
68
69 if (step.mustReplicate())
70 return;
71
72 auto left_broadcast_hint = std::dynamic_pointer_cast<BroadcastJoin>(left_hint);
73 auto right_broadcast_hint = std::dynamic_pointer_cast<BroadcastJoin>(right_hint);
74 auto left_repartition_hint = std::dynamic_pointer_cast<RepartitionJoin>(left_hint);
75 auto right_repartition_hint = std::dynamic_pointer_cast<RepartitionJoin>(right_hint);
76
77 // If the nodes on the left and right have different types of hints return;
78 if ((left_broadcast_hint && right_broadcast_hint)
79 || (left_repartition_hint && right_broadcast_hint)
80 || (right_broadcast_hint && right_repartition_hint))
81 return;
82
83 if (left_broadcast_hint && supportSwap(step))

Callers

nothing calls this directly

Calls 15

getChildrenMethod · 0.80
getStepMethod · 0.80
mustRepartitionMethod · 0.80
mustReplicateMethod · 0.80
isHasUsingMethod · 0.80
getRequireRightKeysMethod · 0.80
getJoinAlgorithmMethod · 0.80
isMagicMethod · 0.80
isSimpleReorderedMethod · 0.80
has_valueMethod · 0.80
getFunction · 0.50

Tested by

no test coverage detected