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

Function transformSortClause

src/backend/parser/parse_clause.c:2818–2845  ·  view source on GitHub ↗

* transformSortClause - * transform an ORDER BY clause * * ORDER BY items will be added to the targetlist (as resjunk columns) * if not already present, so the targetlist must be passed by reference. * * This is also used for window and aggregate ORDER BY clauses (which act * almost the same, but are always interpreted per SQL99 rules). */

Source from the content-addressed store, hash-verified

2816 * almost the same, but are always interpreted per SQL99 rules).
2817 */
2818List *
2819transformSortClause(ParseState *pstate,
2820 List *orderlist,
2821 List **targetlist,
2822 ParseExprKind exprKind,
2823 bool useSQL99)
2824{
2825 List *sortlist = NIL;
2826 ListCell *olitem;
2827
2828 foreach(olitem, orderlist)
2829 {
2830 SortBy *sortby = (SortBy *) lfirst(olitem);
2831 TargetEntry *tle;
2832
2833 if (useSQL99)
2834 tle = findTargetlistEntrySQL99(pstate, sortby->node,
2835 targetlist, exprKind);
2836 else
2837 tle = findTargetlistEntrySQL92(pstate, sortby->node,
2838 targetlist, exprKind);
2839
2840 sortlist = addTargetToSortList(pstate, tle,
2841 sortlist, *targetlist, sortby);
2842 }
2843
2844 return sortlist;
2845}
2846
2847/*
2848 * transformWindowDefinitions -

Callers 6

transformSelectStmtFunction · 0.85
transformValuesClauseFunction · 0.85
transformPLAssignStmtFunction · 0.85
transformAggregateCallFunction · 0.85

Calls 4

findTargetlistEntrySQL99Function · 0.85
findTargetlistEntrySQL92Function · 0.85
addTargetToSortListFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected