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

Function get_dqa_expr

src/backend/utils/adt/ruleutils.c:10144–10177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10142}
10143
10144static void
10145get_dqa_expr(DQAExpr *dqa_expr,deparse_context *context)
10146{
10147 int id = -1;
10148 StringInfo buf = context->buf;
10149 Bitmapset *bm = dqa_expr->agg_args_id_bms;
10150 deparse_namespace *dnps = (deparse_namespace *) linitial(context->namespaces);
10151
10152 resetStringInfo(buf);
10153 appendStringInfoChar(buf, '(');
10154 while ((id = bms_next_member(bm, id)) >= 0)
10155 {
10156 TargetEntry *te = get_sortgroupref_tle((Index)id, dnps->plan->targetlist);
10157 char *exprstr;
10158
10159 if (!te)
10160 elog(ERROR, "no tlist entry for sort key: %d", id);
10161 /* Deparse the expression, showing any top-level cast */
10162 exprstr = deparse_expression((Node *) te->expr, context->namespaces,
10163 context->varprefix, true);
10164
10165 appendStringInfoString(buf, exprstr);
10166 appendStringInfoChar(buf, ',');
10167 }
10168 buf->data[buf->len - 1] = ')';
10169
10170 if (dqa_expr->agg_filter != NULL)
10171 {
10172 appendStringInfoString(buf, " FILTER (WHERE ");
10173 get_rule_expr((Node *) dqa_expr->agg_filter, context, false);
10174 appendStringInfoChar(buf, ')');
10175 }
10176
10177}
10178
10179/*
10180 * get_agg_expr - Parse back an Aggref node

Callers 1

get_rule_exprFunction · 0.85

Calls 7

resetStringInfoFunction · 0.85
appendStringInfoCharFunction · 0.85
bms_next_memberFunction · 0.85
get_sortgroupref_tleFunction · 0.85
deparse_expressionFunction · 0.85
appendStringInfoStringFunction · 0.85
get_rule_exprFunction · 0.85

Tested by

no test coverage detected