* Given a slice index, find the motionstate that corresponds to this slice index. This will iterate over the planstate tree * to get the right node. */
| 2281 | * to get the right node. |
| 2282 | */ |
| 2283 | MotionState * |
| 2284 | getMotionState(struct PlanState *ps, int sliceIndex) |
| 2285 | { |
| 2286 | Assert(ps); |
| 2287 | Assert(sliceIndex > -1); |
| 2288 | |
| 2289 | MotionStateFinderContext ctx; |
| 2290 | ctx.motionId = sliceIndex; |
| 2291 | ctx.motionState = NULL; |
| 2292 | planstate_walk_node(ps, MotionStateFinderWalker, &ctx); |
| 2293 | |
| 2294 | if (ctx.motionState == NULL) |
| 2295 | elog(ERROR, "could not find MotionState for slice %d in executor tree", sliceIndex); |
| 2296 | |
| 2297 | return ctx.motionState; |
| 2298 | } |
| 2299 | |
| 2300 | typedef struct MotionFinderContext |
| 2301 | { |
no test coverage detected