| 277 | } |
| 278 | |
| 279 | static 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 | |
| 309 | void HashJoinSIPOptimizer::visitHashJoin(LogicalOperator* op) { |
| 310 | auto& hashJoin = op->cast<LogicalHashJoin>(); |
no test coverage detected