From 128a259b15a3a1521b0acfc5959cf6c4427d6ab8 Mon Sep 17 00:00:00 2001 From: Mehmet Yilmaz Date: Wed, 25 Jun 2025 14:06:38 +0000 Subject: [PATCH] indent --- .../planner/multi_logical_planner.c | 90 ++++++++++--------- 1 file changed, 49 insertions(+), 41 deletions(-) diff --git a/src/backend/distributed/planner/multi_logical_planner.c b/src/backend/distributed/planner/multi_logical_planner.c index 37a00aedd..a3595c92f 100644 --- a/src/backend/distributed/planner/multi_logical_planner.c +++ b/src/backend/distributed/planner/multi_logical_planner.c @@ -136,8 +136,7 @@ static MultiNode * ApplyCartesianProductReferenceJoin(MultiNode *leftNode, static MultiNode * ApplyCartesianProduct(MultiNode *leftNode, MultiNode *rightNode, List *partitionColumnList, JoinType joinType, List *joinClauses); -static bool -ExprMentionsPartitionColumn(Node *node, Query *query); +static bool ExprMentionsPartitionColumn(Node *node, Query *query); /* @@ -227,13 +226,14 @@ TargetListOnPartitionColumn(Query *query, List *targetEntryList) Expr *targetExpression = targetEntry->expr; bool isPartitionColumn = ExprMentionsPartitionColumn((Node *) targetExpression, - query); + query); Var *column = NULL; RangeTblEntry *rte = NULL; FindReferencedTableColumn(targetExpression, NIL, query, &column, &rte, - /*skipOuterVars=*/false); + + /*skipOuterVars=*/ false); Oid relationId = rte ? rte->relid : InvalidOid; /* @@ -307,50 +307,58 @@ TargetListOnPartitionColumn(Query *query, List *targetEntryList) static bool ExprMentionsPartitionColumn(Node *node, Query *query) { - if (node == NULL) - return false; + if (node == NULL) + { + return false; + } - if (IsA(node, Var)) - { - Var *v = (Var *) node; + if (IsA(node, Var)) + { + Var *v = (Var *) node; - /* Follow OUTER_VAR → target-list indirection, if present */ - if (v->varno == OUTER_VAR) - { - TargetEntry *tle = get_tle_by_resno(query->targetList, v->varattno); - return tle && ExprMentionsPartitionColumn((Node *) tle->expr, query); - } + /* Follow OUTER_VAR → target-list indirection, if present */ + if (v->varno == OUTER_VAR) + { + TargetEntry *tle = get_tle_by_resno(query->targetList, v->varattno); + return tle && ExprMentionsPartitionColumn((Node *) tle->expr, query); + } - /* Sanity-check varno */ - if (v->varno <= 0 || v->varno > list_length(query->rtable)) - return false; + /* Sanity-check varno */ + if (v->varno <= 0 || v->varno > list_length(query->rtable)) + { + return false; + } - RangeTblEntry *rte = rt_fetch(v->varno, query->rtable); + RangeTblEntry *rte = rt_fetch(v->varno, query->rtable); #if PG_VERSION_NUM >= 180000 - /* Synthetic GROUP RTE – examine its expressions instead */ - if (rte->rtekind == RTE_GROUP && rte->groupexprs) - { - ListCell *lc; - foreach (lc, rte->groupexprs) - if (ExprMentionsPartitionColumn((Node *) lfirst(lc), query)) - return true; - return false; - } -#endif - /* Real table? — compare against its dist key */ - if (rte->rtekind == RTE_RELATION && HasDistributionKey(rte->relid)) - { - Var *partcol = DistPartitionKey(rte->relid); - return partcol && partcol->varattno == v->varattno; - } - return false; - } - /* Recurse through any other node type */ - return expression_tree_walker(node, - ExprMentionsPartitionColumn, - (void *) query); + /* Synthetic GROUP RTE – examine its expressions instead */ + if (rte->rtekind == RTE_GROUP && rte->groupexprs) + { + ListCell *lc; + foreach(lc, rte->groupexprs) + if (ExprMentionsPartitionColumn((Node *) lfirst(lc), query)) + { + return true; + } + return false; + } +#endif + + /* Real table? — compare against its dist key */ + if (rte->rtekind == RTE_RELATION && HasDistributionKey(rte->relid)) + { + Var *partcol = DistPartitionKey(rte->relid); + return partcol && partcol->varattno == v->varattno; + } + return false; + } + + /* Recurse through any other node type */ + return expression_tree_walker(node, + ExprMentionsPartitionColumn, + (void *) query); }