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

Function cdbpullup_missingVarWalker

src/backend/cdb/cdbpullup.c:437–467  ·  view source on GitHub ↗

* cdbpullup_missingVarWalker * * Returns true if some Var in expr is not in targetlist. * 'targetlist' is either a List of TargetEntry, or a plain List of Expr. * * NB: A Var in the expr is considered as matching a Var in the targetlist * without regard for whether or not there is a RelabelType node atop the * targetlist Var. * */

Source from the content-addressed store, hash-verified

435 *
436 */
437static bool
438cdbpullup_missingVarWalker(Expr *node, void *targetlist)
439{
440 if (!node)
441 return false;
442
443 /*
444 * Should also consider PlaceHolderVar in the targetlist.
445 * See github issue: https://github.com/greenplum-db/gpdb/issues/10315
446 */
447 if (IsA(node, Var) || IsA(node, PlaceHolderVar))
448 {
449 if (!targetlist)
450 return true;
451
452 /* is targetlist a List of TargetEntry? */
453 if (IsA(linitial(targetlist), TargetEntry))
454 {
455 if (tlist_member_ignore_relabel(node, (List *) targetlist))
456 return false; /* this Var ok - go on to check rest of expr */
457 }
458
459 /* targetlist must be a List of Expr */
460 else if (list_member((List *) targetlist, node))
461 return false; /* this Var ok - go on to check rest of expr */
462
463 return true; /* Var is not in targetlist - quit the walk */
464 }
465
466 return expression_tree_walker((Node *) node, cdbpullup_missingVarWalker, targetlist);
467} /* cdbpullup_missingVarWalker */

Callers 1

Calls 3

list_memberFunction · 0.85
expression_tree_walkerFunction · 0.85

Tested by

no test coverage detected