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

Function transformGroupClauseList

src/backend/parser/parse_clause.c:2561–2593  ·  view source on GitHub ↗

* Transform a list of expressions within a GROUP BY clause or grouping set. * * The list of expressions belongs to a single clause within which duplicates * can be safely eliminated. * * Returns an integer list of ressortgroupref values. * * flatresult reference to flat list of SortGroupClause nodes * pstate ParseState * list nodes to transform * targetlist reference to TargetEntry li

Source from the content-addressed store, hash-verified

2559 * toplevel false if within any grouping set
2560 */
2561static List *
2562transformGroupClauseList(List **flatresult,
2563 ParseState *pstate, List *list,
2564 List **targetlist, List *sortClause,
2565 ParseExprKind exprKind, bool useSQL99, bool toplevel)
2566{
2567 Bitmapset *seen_local = NULL;
2568 List *result = NIL;
2569 ListCell *gl;
2570
2571 foreach(gl, list)
2572 {
2573 Node *gexpr = (Node *) lfirst(gl);
2574
2575 Index ref = transformGroupClauseExpr(flatresult,
2576 seen_local,
2577 pstate,
2578 gexpr,
2579 targetlist,
2580 sortClause,
2581 exprKind,
2582 useSQL99,
2583 toplevel);
2584
2585 if (ref > 0)
2586 {
2587 seen_local = bms_add_member(seen_local, ref);
2588 result = lappend_int(result, ref);
2589 }
2590 }
2591
2592 return result;
2593}
2594
2595/*
2596 * Transform a grouping set and (recursively) its content.

Callers 1

transformGroupingSetFunction · 0.85

Calls 4

transformGroupClauseExprFunction · 0.85
bms_add_memberFunction · 0.85
lappend_intFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected