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

Function FinishSortSupportFunction

src/backend/utils/sort/sortsupport.c:94–125  ·  view source on GitHub ↗

* Look up and call sortsupport function to setup SortSupport comparator; * or if no such function exists or it declines to set up the appropriate * state, prepare a suitable shim. */

Source from the content-addressed store, hash-verified

92 * state, prepare a suitable shim.
93 */
94static void
95FinishSortSupportFunction(Oid opfamily, Oid opcintype, SortSupport ssup)
96{
97 Oid sortSupportFunction;
98
99 /* Look for a sort support function */
100 sortSupportFunction = get_opfamily_proc(opfamily, opcintype, opcintype,
101 BTSORTSUPPORT_PROC);
102 if (OidIsValid(sortSupportFunction))
103 {
104 /*
105 * The sort support function can provide a comparator, but it can also
106 * choose not to so (e.g. based on the selected collation).
107 */
108 OidFunctionCall1(sortSupportFunction, PointerGetDatum(ssup));
109 }
110
111 if (ssup->comparator == NULL)
112 {
113 Oid sortFunction;
114
115 sortFunction = get_opfamily_proc(opfamily, opcintype, opcintype,
116 BTORDER_PROC);
117
118 if (!OidIsValid(sortFunction))
119 elog(ERROR, "missing support function %d(%u,%u) in opfamily %u",
120 BTORDER_PROC, opcintype, opcintype, opfamily);
121
122 /* We'll use a shim to call the old-style btree comparator */
123 PrepareSortSupportComparisonShim(sortFunction, ssup);
124 }
125}
126
127/*
128 * Fill in SortSupport given an ordering operator (btree "<" or ">" operator).

Calls 2

get_opfamily_procFunction · 0.85

Tested by

no test coverage detected