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

Function flatten_logic_exprs

src/backend/executor/execUtils.c:1423–1452  ·  view source on GitHub ↗

* flatten_logic_exprs * This function is only used by ExecPrefetchJoinQual. * ExecPrefetchJoinQual need to prefetch subplan in join * qual that contains motion to materialize it to avoid * motion deadlock. This function is going to flatten * the bool exprs to avoid shortcut of bool logic. * An example is: * (a and b or c) or (d or e and f or g) and (h and i or j) * will be transformed to

Source from the content-addressed store, hash-verified

1421 * (a, b, c, d, e, f, g, h, i, j).
1422 */
1423static List *
1424flatten_logic_exprs(Node *node)
1425{
1426 if (node == NULL)
1427 return NIL;
1428
1429 if (IsA(node, BoolExpr))
1430 {
1431 BoolExpr *be = (BoolExpr *) node;
1432 return flatten_logic_exprs((Node *) (be->args));
1433 }
1434
1435 if (IsA(node, List))
1436 {
1437 List *es = (List *) node;
1438 List *result = NIL;
1439 ListCell *lc = NULL;
1440
1441 foreach(lc, es)
1442 {
1443 Node *n = (Node *) lfirst(lc);
1444 result = list_concat(result,
1445 flatten_logic_exprs(n));
1446 }
1447
1448 return result;
1449 }
1450
1451 return list_make1(node);
1452}
1453
1454/*
1455 * fake_outer_params

Callers 1

ExecPrefetchQualFunction · 0.85

Calls 2

list_concatFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected