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

Function assign_aggregate_collations

src/backend/parser/parse_collate.c:885–904  ·  view source on GitHub ↗

* Aggref is a special case because expressions used only for ordering * shouldn't be taken to conflict with each other or with regular args, * indeed shouldn't affect the aggregate's result collation at all. * We handle this by applying assign_expr_collations() to them rather than * passing down our loccontext. * * Note that we recurse to each TargetEntry, not directly to its contained * ex

Source from the content-addressed store, hash-verified

883 * contain only SortGroupClause nodes which we need not process.
884 */
885static void
886assign_aggregate_collations(Aggref *aggref,
887 assign_collations_context *loccontext)
888{
889 ListCell *lc;
890
891 /* Plain aggregates have no direct args */
892 Assert(aggref->aggdirectargs == NIL);
893
894 /* Process aggregated args, holding resjunk ones at arm's length */
895 foreach(lc, aggref->args)
896 {
897 TargetEntry *tle = lfirst_node(TargetEntry, lc);
898
899 if (tle->resjunk)
900 assign_expr_collations(loccontext->pstate, (Node *) tle);
901 else
902 (void) assign_collations_walker((Node *) tle, loccontext);
903 }
904}
905
906/*
907 * For ordered-set aggregates, it's somewhat unclear how best to proceed.

Callers 1

assign_collations_walkerFunction · 0.85

Calls 3

assign_expr_collationsFunction · 0.85
assign_collations_walkerFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected