| 202 | } |
| 203 | |
| 204 | static bool _ExecutionPlan_HasLocateTaps |
| 205 | ( |
| 206 | OpBase *root |
| 207 | ) { |
| 208 | if((root->childCount == 0 && root->type != OPType_ARGUMENT && |
| 209 | root->type != OPType_ARGUMENT_LIST) || |
| 210 | // when Foreach or Call {} have a single child, they don't need a tap |
| 211 | (root->childCount == 1 && |
| 212 | (root->type == OPType_FOREACH || root->type == OPType_CALLSUBQUERY)) |
| 213 | ) { |
| 214 | return true; |
| 215 | } |
| 216 | |
| 217 | // recursively visit children |
| 218 | for(int i = 0; i < root->childCount; i++) { |
| 219 | if(_ExecutionPlan_HasLocateTaps(root->children[i])) { |
| 220 | return true; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | return false; |
| 225 | } |
| 226 | |
| 227 | static ExecutionPlan *_tie_segments |
| 228 | ( |