Best equality on `var` reachable through AND alone. An AND chain is linked * along the right child (expr_chain_link), so the links are walked in a loop * and only each link's left operand recurses. */
| 5884 | * along the right child (expr_chain_link), so the links are walked in a loop |
| 5885 | * and only each link's left operand recurses. */ |
| 5886 | static int cypher_expr_selectivity(const cbm_expr_t *e, // NOLINT(misc-no-recursion) |
| 5887 | const char *var) { |
| 5888 | int best = 0; |
| 5889 | while (e) { |
| 5890 | if (e->type == EXPR_CONDITION) { |
| 5891 | int s = cypher_cond_selectivity(&e->cond, var); |
| 5892 | return s > best ? s : best; |
| 5893 | } |
| 5894 | if (e->type != EXPR_AND) { |
| 5895 | return best; /* OR / NOT / XOR: no single equality to seed from */ |
| 5896 | } |
| 5897 | int l = cypher_expr_selectivity(e->left, var); |
| 5898 | if (l > best) { |
| 5899 | best = l; |
| 5900 | } |
| 5901 | e = e->right; |
| 5902 | } |
| 5903 | return best; |
| 5904 | } |
| 5905 | |
| 5906 | static int cypher_node_selectivity(const cbm_node_pattern_t *n, const cbm_where_clause_t *w) { |
| 5907 | int s = 0; |
no test coverage detected