| 204 | } |
| 205 | |
| 206 | static 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 | |
| 239 | static bool tryProbeToBuildHJSIP(LogicalOperator* op) { |
| 240 | auto& hashJoin = op->cast<LogicalHashJoin>(); |
no test coverage detected