MCPcopy Create free account
hub / github.com/apache/cloudberry / ExecutePlan

Function ExecutePlan

src/backend/executor/execMain.c:2706–2876  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecutePlan * * Processes the query plan until we have retrieved 'numberTuples' tuples, * moving in the specified direction. * * Runs to completion if numberTuples is 0 * * Note: the ctid attribute is a 'junk' attribute that is removed before the * user can see it * ----------------------------------------------------

Source from the content-addressed store, hash-verified

2704 * ----------------------------------------------------------------
2705 */
2706static void
2707ExecutePlan(EState *estate,
2708 PlanState *planstate,
2709 bool use_parallel_mode,
2710 CmdType operation,
2711 bool sendTuples,
2712 uint64 numberTuples,
2713 ScanDirection direction,
2714 DestReceiver *dest,
2715 bool execute_once)
2716{
2717 TupleTableSlot *slot;
2718 uint64 current_tuple_count;
2719
2720 /*
2721 * For holdable cursor, the plan is executed without rewinding on gpdb. We
2722 * need to quit if the executor has already emitted all tuples.
2723 */
2724 if (estate->es_got_eos)
2725 return;
2726
2727 /*
2728 * initialize local variables
2729 */
2730 current_tuple_count = 0;
2731
2732 /*
2733 * Set the direction.
2734 */
2735 estate->es_direction = direction;
2736
2737 /*
2738 * If the plan might potentially be executed multiple times, we must force
2739 * it to run without parallelism, because we might exit early.
2740 */
2741 if (!execute_once || GP_ROLE_DISPATCH == Gp_role)
2742 use_parallel_mode = false;
2743
2744 estate->es_use_parallel_mode = use_parallel_mode;
2745 if (use_parallel_mode)
2746 EnterParallelMode();
2747
2748 /*
2749 * CBDB style parallelism won't interfere PG style parallel mechanism.
2750 * So that we will pass if use_parallel_mode is true which means there exists
2751 * Gather/GatherMerge node.
2752 */
2753 if (estate->useMppParallelMode)
2754 GpInsertParallelDSMHash(planstate);
2755
2756#ifdef FAULT_INJECTOR
2757 /* Inject a fault before tuple processing started */
2758 SIMPLE_FAULT_INJECTOR("executor_pre_tuple_processed");
2759#endif /* FAULT_INJECTOR */
2760
2761 /*
2762 * Loop until we've processed the proper number of tuples from the plan.
2763 */

Callers 1

standard_ExecutorRunFunction · 0.85

Calls 7

EnterParallelModeFunction · 0.85
GpInsertParallelDSMHashFunction · 0.85
ExecProcNodeFunction · 0.85
ExecShutdownNodeFunction · 0.85
ExecFilterJunkFunction · 0.85
ExitParallelModeFunction · 0.85

Tested by

no test coverage detected