| 143 | |
| 144 | |
| 145 | void InvertCondOptimizer::check_node_except_subroot(QueryNode *invert_cond, |
| 146 | QueryNode *invert_subroot, |
| 147 | bool *rest_has_invert) { |
| 148 | if (invert_cond == nullptr) { |
| 149 | return; |
| 150 | } |
| 151 | |
| 152 | // skip subroot |
| 153 | if (invert_subroot != nullptr && invert_cond == invert_subroot) { |
| 154 | return; |
| 155 | } |
| 156 | |
| 157 | if (invert_cond->type() == QueryNode::QueryNodeType::REL_EXPR) { |
| 158 | QueryRelNode *query_rel_node = |
| 159 | reinterpret_cast<QueryRelNode *>(invert_cond); |
| 160 | if (query_rel_node->rule_result()) { |
| 161 | *rest_has_invert = true; |
| 162 | } |
| 163 | return; |
| 164 | } |
| 165 | |
| 166 | check_node_except_subroot(invert_cond->left().get(), invert_subroot, |
| 167 | rest_has_invert); |
| 168 | if (*rest_has_invert) { |
| 169 | return; |
| 170 | } |
| 171 | check_node_except_subroot(invert_cond->right().get(), invert_subroot, |
| 172 | rest_has_invert); |
| 173 | } |
| 174 | |
| 175 | bool InvertCondOptimizer::apply_optimize_result(QueryInfo *query_info, |
| 176 | QueryNode *invert_subroot) { |
nothing calls this directly
no test coverage detected