MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / tryApplySemiMask

Function tryApplySemiMask

src/optimizer/acc_hash_join_optimizer.cpp:206–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206static std::shared_ptr<LogicalOperator> tryApplySemiMask(std::shared_ptr<Expression> nodeID,
207 std::shared_ptr<LogicalOperator> fromRoot, LogicalOperator* toRoot) {
208 // TODO(Xiyang): Check if a semi mask can/need to be applied to ScanNodeTable, RecursiveJoin &
209 // GDS at the same time
210 auto recursiveExtendInputNodeCandidates =
211 getRecursiveExtendInputNodeCandidates(*nodeID, toRoot);
212 if (!recursiveExtendInputNodeCandidates.empty()) {
213 for (auto& op : recursiveExtendInputNodeCandidates) {
214 op->cast<LogicalRecursiveExtend>().setInputNodeMask();
215 }
216 auto targetType = SemiMaskTargetType::RECURSIVE_EXTEND_INPUT_NODE;
217 DASSERT(sanityCheckCandidates(recursiveExtendInputNodeCandidates, targetType));
218 return appendSemiMasker(SemiMaskKeyType::NODE, targetType, std::move(nodeID),
219 recursiveExtendInputNodeCandidates, std::move(fromRoot));
220 }
221 auto recursiveExtendNodeCandidates = getRecursiveExtendOutputNodeCandidates(*nodeID, toRoot);
222 if (!recursiveExtendNodeCandidates.empty()) {
223 for (auto& op : recursiveExtendNodeCandidates) {
224 op->cast<LogicalRecursiveExtend>().setOutputNodeMask();
225 }
226 auto targetType = SemiMaskTargetType::RECURSIVE_EXTEND_OUTPUT_NODE;
227 DASSERT(sanityCheckCandidates(recursiveExtendNodeCandidates, targetType));
228 return appendSemiMasker(SemiMaskKeyType::NODE, targetType, std::move(nodeID),
229 recursiveExtendNodeCandidates, std::move(fromRoot));
230 }
231 auto scanNodeCandidates = getScanNodeCandidates(*nodeID, toRoot);
232 if (!scanNodeCandidates.empty()) {
233 return appendSemiMasker(SemiMaskKeyType::NODE, SemiMaskTargetType::SCAN_NODE,
234 std::move(nodeID), scanNodeCandidates, std::move(fromRoot));
235 }
236 return nullptr;
237}
238
239static bool tryProbeToBuildHJSIP(LogicalOperator* op) {
240 auto& hashJoin = op->cast<LogicalHashJoin>();

Callers 2

tryProbeToBuildHJSIPFunction · 0.85
tryBuildToProbeHJSIPFunction · 0.85

Calls 8

sanityCheckCandidatesFunction · 0.85
appendSemiMaskerFunction · 0.85
getScanNodeCandidatesFunction · 0.85
emptyMethod · 0.45
setInputNodeMaskMethod · 0.45
setOutputNodeMaskMethod · 0.45

Tested by

no test coverage detected