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

Function ExecInitIncrementalSort

src/backend/executor/nodeIncrementalSort.c:974–1069  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecInitIncrementalSort * * Creates the run-time state information for the sort node * produced by the planner and initializes its outer subtree. * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

972 * ----------------------------------------------------------------
973 */
974IncrementalSortState *
975ExecInitIncrementalSort(IncrementalSort *node, EState *estate, int eflags)
976{
977 IncrementalSortState *incrsortstate;
978
979 SO_printf("ExecInitIncrementalSort: initializing sort node\n");
980
981 /*
982 * Incremental sort can't be used with EXEC_FLAG_BACKWARD or
983 * EXEC_FLAG_MARK, because the current sort state contains only one sort
984 * batch rather than the full result set.
985 */
986 Assert((eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)) == 0);
987
988 /* Initialize state structure. */
989 incrsortstate = makeNode(IncrementalSortState);
990 incrsortstate->ss.ps.plan = (Plan *) node;
991 incrsortstate->ss.ps.state = estate;
992 incrsortstate->ss.ps.ExecProcNode = ExecIncrementalSort;
993
994 incrsortstate->execution_status = INCSORT_LOADFULLSORT;
995 incrsortstate->bounded = false;
996 incrsortstate->outerNodeDone = false;
997 incrsortstate->bound_Done = 0;
998 incrsortstate->fullsort_state = NULL;
999 incrsortstate->prefixsort_state = NULL;
1000 incrsortstate->group_pivot = NULL;
1001 incrsortstate->transfer_tuple = NULL;
1002 incrsortstate->n_fullsort_remaining = 0;
1003 incrsortstate->presorted_keys = NULL;
1004
1005 if (incrsortstate->ss.ps.instrument != NULL)
1006 {
1007 IncrementalSortGroupInfo *fullsortGroupInfo =
1008 &incrsortstate->incsort_info.fullsortGroupInfo;
1009 IncrementalSortGroupInfo *prefixsortGroupInfo =
1010 &incrsortstate->incsort_info.prefixsortGroupInfo;
1011
1012 fullsortGroupInfo->groupCount = 0;
1013 fullsortGroupInfo->maxDiskSpaceUsed = 0;
1014 fullsortGroupInfo->totalDiskSpaceUsed = 0;
1015 fullsortGroupInfo->maxMemorySpaceUsed = 0;
1016 fullsortGroupInfo->totalMemorySpaceUsed = 0;
1017 fullsortGroupInfo->sortMethods = 0;
1018 prefixsortGroupInfo->groupCount = 0;
1019 prefixsortGroupInfo->maxDiskSpaceUsed = 0;
1020 prefixsortGroupInfo->totalDiskSpaceUsed = 0;
1021 prefixsortGroupInfo->maxMemorySpaceUsed = 0;
1022 prefixsortGroupInfo->totalMemorySpaceUsed = 0;
1023 prefixsortGroupInfo->sortMethods = 0;
1024 }
1025
1026 /*
1027 * Miscellaneous initialization
1028 *
1029 * Sort nodes don't initialize their ExprContexts because they never call
1030 * ExecQual or ExecProject.
1031 */

Callers 1

ExecInitNodeFunction · 0.85

Calls 5

ExecInitNodeFunction · 0.85
MakeSingleTupleTableSlotFunction · 0.85
ExecGetResultTypeFunction · 0.85

Tested by

no test coverage detected