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

Function transformFuncCall

src/backend/parser/parse_expr.c:1385–1428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1383}
1384
1385static Node *
1386transformFuncCall(ParseState *pstate, FuncCall *fn)
1387{
1388 Node *last_srf = pstate->p_last_srf;
1389 List *targs;
1390 ListCell *args;
1391
1392 /* Transform the list of arguments ... */
1393 targs = NIL;
1394 foreach(args, fn->args)
1395 {
1396 targs = lappend(targs, transformExprRecurse(pstate,
1397 (Node *) lfirst(args)));
1398 }
1399
1400 /*
1401 * When WITHIN GROUP is used, we treat its ORDER BY expressions as
1402 * additional arguments to the function, for purposes of function lookup
1403 * and argument type coercion. So, transform each such expression and add
1404 * them to the targs list. We don't explicitly mark where each argument
1405 * came from, but ParseFuncOrColumn can tell what's what by reference to
1406 * list_length(fn->agg_order).
1407 */
1408 if (fn->agg_within_group)
1409 {
1410 Assert(fn->agg_order != NIL);
1411 foreach(args, fn->agg_order)
1412 {
1413 SortBy *arg = (SortBy *) lfirst(args);
1414
1415 targs = lappend(targs, transformExpr(pstate, arg->node,
1416 EXPR_KIND_ORDER_BY));
1417 }
1418 }
1419
1420 /* ... and hand off to ParseFuncOrColumn */
1421 return ParseFuncOrColumn(pstate,
1422 fn->funcname,
1423 targs,
1424 last_srf,
1425 fn,
1426 false,
1427 fn->location);
1428}
1429
1430/*
1431 * Check if this is CASE x WHEN IS NOT DISTINCT FROM y:

Callers 1

transformExprRecurseFunction · 0.85

Calls 5

lappendFunction · 0.85
transformExprRecurseFunction · 0.85
transformExprFunction · 0.85
ParseFuncOrColumnFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected