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

Function tryBuildToProbeHJSIP

src/optimizer/acc_hash_join_optimizer.cpp:279–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279static bool tryBuildToProbeHJSIP(LogicalOperator* op) {
280 auto& hashJoin = op->cast<LogicalHashJoin>();
281 if (hashJoin.getJoinType() != JoinType::INNER) {
282 return false;
283 }
284 if (hashJoin.getSIPInfo().direction != SIPDirection::FORCE_BUILD_TO_PROBE &&
285 !isBuildSideQualified(op->getChild(1).get())) {
286 return false;
287 }
288 auto probeRoot = hashJoin.getChild(0);
289 auto buildRoot = hashJoin.getChild(1);
290 auto hasSemiMaskApplied = false;
291 for (auto& nodeID : hashJoin.getJoinNodeIDs()) {
292 auto newBuildRoot = tryApplySemiMask(nodeID, buildRoot, probeRoot.get());
293 if (newBuildRoot != nullptr) {
294 buildRoot = newBuildRoot;
295 hasSemiMaskApplied = true;
296 }
297 }
298 if (!hasSemiMaskApplied) {
299 return false;
300 }
301 auto& sipInfo = hashJoin.getSIPInfoUnsafe();
302 sipInfo.position = SemiMaskPosition::ON_BUILD;
303 sipInfo.dependency = SIPDependency::BUILD_DEPENDS_ON_PROBE;
304 sipInfo.direction = SIPDirection::BUILD_TO_PROBE;
305 hashJoin.setChild(1, buildRoot);
306 return true;
307}
308
309void HashJoinSIPOptimizer::visitHashJoin(LogicalOperator* op) {
310 auto& hashJoin = op->cast<LogicalHashJoin>();

Callers 1

visitHashJoinMethod · 0.85

Calls 8

isBuildSideQualifiedFunction · 0.85
tryApplySemiMaskFunction · 0.85
getJoinTypeMethod · 0.80
getJoinNodeIDsMethod · 0.80
setChildMethod · 0.80
getSIPInfoMethod · 0.45
getMethod · 0.45
getChildMethod · 0.45

Tested by

no test coverage detected