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

Function InitPlan

src/backend/executor/execMain.c:1753–2076  ·  view source on GitHub ↗

---------------------------------------------------------------- * InitPlan * * Initializes the query plan: open files, allocate storage * and start up the rule manager * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

1751 * ----------------------------------------------------------------
1752 */
1753static void
1754InitPlan(QueryDesc *queryDesc, int eflags)
1755{
1756 CmdType operation = queryDesc->operation;
1757 PlannedStmt *plannedstmt = queryDesc->plannedstmt;
1758 Plan *plan = plannedstmt->planTree;
1759 List *rangeTable = plannedstmt->rtable;
1760 EState *estate = queryDesc->estate;
1761 PlanState *planstate;
1762 TupleDesc tupType;
1763 ListCell *l;
1764
1765 Assert(plannedstmt->intoPolicy == NULL ||
1766 GpPolicyIsPartitioned(plannedstmt->intoPolicy) ||
1767 GpPolicyIsReplicated(plannedstmt->intoPolicy));
1768
1769 if (DEBUG1 >= log_min_messages)
1770 {
1771 char msec_str[32];
1772 switch (check_log_duration(msec_str, false))
1773 {
1774 case 1:
1775 case 2:
1776 ereport(LOG, (errmsg("duration to InitPlan start: %s ms", msec_str)));
1777 break;
1778 default:
1779 /* do nothing */
1780 break;
1781 }
1782 }
1783
1784 /*
1785 * Do permissions checks
1786 */
1787 if (operation != CMD_SELECT || Gp_role != GP_ROLE_EXECUTE)
1788 {
1789 ExecCheckRTPerms(rangeTable, true);
1790 }
1791
1792 /*
1793 * initialize the node's execution state
1794 */
1795 ExecInitRangeTable(estate, rangeTable);
1796
1797 estate->es_plannedstmt = plannedstmt;
1798
1799 /*
1800 * Next, build the ExecRowMark array from the PlanRowMark(s), if any.
1801 */
1802 if (plannedstmt->rowMarks)
1803 {
1804 estate->es_rowmarks = (ExecRowMark **)
1805 palloc0(estate->es_range_table_size * sizeof(ExecRowMark *));
1806 foreach(l, plannedstmt->rowMarks)
1807 {
1808 PlanRowMark *rc = (PlanRowMark *) lfirst(l);
1809 Oid relid;
1810 Relation relation;

Callers 1

standard_ExecutorStartFunction · 0.85

Calls 15

GpPolicyIsPartitionedFunction · 0.85
GpPolicyIsReplicatedFunction · 0.85
check_log_durationFunction · 0.85
ExecCheckRTPermsFunction · 0.85
ExecInitRangeTableFunction · 0.85
exec_rt_fetchFunction · 0.85
CheckValidRowMarkRelFunction · 0.85
findSenderMotionFunction · 0.85
bms_is_memberFunction · 0.85

Tested by

no test coverage detected