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

Function apply_attrmap_mutator

src/backend/executor/execMain.c:4179–4205  ·  view source on GitHub ↗

For attrMapExpr below. * * Mutate Var nodes in an expression using the given attribute map. * Insist the Var nodes have varno == 1 and the that the mapping * yields a live attribute number (non-zero). */

Source from the content-addressed store, hash-verified

4177 * yields a live attribute number (non-zero).
4178 */
4179static Node *apply_attrmap_mutator(Node *node, TupleConversionMap *map)
4180{
4181 if ( node == NULL )
4182 return NULL;
4183
4184 if (IsA(node, Var) )
4185 {
4186 Var *var = (Var *) node;
4187 AttrNumber anum;
4188
4189 Assert(var->varno == 1); /* in CHECK constraints */
4190 anum = attrMap(map, var->varattno);
4191
4192 if (anum == 0)
4193 {
4194 /* Should never happen, but best caught early. */
4195 elog(ERROR, "attribute map discrepancy");
4196 }
4197 else if (anum != var->varattno)
4198 {
4199 var = copyObject(var);
4200 var->varattno = anum;
4201 }
4202 return (Node *) var;
4203 }
4204 return expression_tree_mutator(node, apply_attrmap_mutator, (void *) map);
4205}
4206
4207/* Apply attrMap over the Var nodes in an expression. */
4208Node *

Callers 1

attrMapExprFunction · 0.85

Calls 2

attrMapFunction · 0.85
expression_tree_mutatorFunction · 0.85

Tested by

no test coverage detected