Rename apply_at to apply_agg_at for clarity
authorRichard Guo <rguo@postgresql.org>
Tue, 14 Oct 2025 07:35:22 +0000 (16:35 +0900)
committerRichard Guo <rguo@postgresql.org>
Tue, 14 Oct 2025 07:35:22 +0000 (16:35 +0900)
The field name "apply_at" in RelAggInfo was a bit ambiguous.  Rename
it to "apply_agg_at" to improve clarity and make its purpose clearer.

Per complaint from David Rowley, Robert Haas.

Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CA+TgmoZ0KR2_XCWHy17=HHcQ3p2Mamc9c6Dnnhf1J6wPYFD9ng@mail.gmail.com

src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/util/relnode.c
src/include/nodes/pathnodes.h

index ec27c1a49941aad81405b9e7972e9aa67b7466ba..9c6436eb72f28e525a9bf8bda9a2634d60c7b824 100644 (file)
@@ -3449,7 +3449,7 @@ generate_grouped_paths(PlannerInfo *root, RelOptInfo *grouped_rel,
     * We push partial aggregation only to the lowest possible level in the
     * join tree that is deemed useful.
     */
-   if (!bms_equal(agg_info->apply_at, rel->relids) ||
+   if (!bms_equal(agg_info->apply_agg_at, rel->relids) ||
        !agg_info->agg_useful)
        return;
 
index 43b84d239ed4e425c60765912b9001dfcea08dbd..5d1fc3899dae10fcdc92c21c5bde65c3a5a362a4 100644 (file)
@@ -922,7 +922,7 @@ make_grouped_join_rel(PlannerInfo *root, RelOptInfo *rel1,
    RelOptInfo *grouped_rel2;
    bool        rel1_empty;
    bool        rel2_empty;
-   Relids      agg_apply_at;
+   Relids      apply_agg_at;
 
    /*
     * If there are no aggregate expressions or grouping expressions, eager
@@ -979,9 +979,9 @@ make_grouped_join_rel(PlannerInfo *root, RelOptInfo *rel1,
                                       rel1_empty ? rel1 : grouped_rel1,
                                       rel2_empty ? rel2 : grouped_rel2,
                                       sjinfo, restrictlist);
-           agg_info->apply_at = rel1_empty ?
-               grouped_rel2->agg_info->apply_at :
-               grouped_rel1->agg_info->apply_at;
+           agg_info->apply_agg_at = rel1_empty ?
+               grouped_rel2->agg_info->apply_agg_at :
+               grouped_rel1->agg_info->apply_agg_at;
        }
        else
        {
@@ -995,7 +995,7 @@ make_grouped_join_rel(PlannerInfo *root, RelOptInfo *rel1,
             * constructed by joining other input relations.
             */
            grouped_rel->rows = agg_info->grouped_rows;
-           agg_info->apply_at = bms_copy(joinrel->relids);
+           agg_info->apply_agg_at = bms_copy(joinrel->relids);
        }
 
        grouped_rel->agg_info = agg_info;
@@ -1019,9 +1019,9 @@ make_grouped_join_rel(PlannerInfo *root, RelOptInfo *rel1,
     * Get the set of relids where partial aggregation is applied among the
     * given input relations.
     */
-   agg_apply_at = rel1_empty ?
-       grouped_rel2->agg_info->apply_at :
-       grouped_rel1->agg_info->apply_at;
+   apply_agg_at = rel1_empty ?
+       grouped_rel2->agg_info->apply_agg_at :
+       grouped_rel1->agg_info->apply_agg_at;
 
    /*
     * If it's not the designated level, skip building grouped paths.
@@ -1037,16 +1037,16 @@ make_grouped_join_rel(PlannerInfo *root, RelOptInfo *rel1,
     * level and still valid for partial aggregation, we update the designated
     * level to (B C), and adjust the size estimates accordingly.
     */
-   if (!bms_equal(agg_apply_at, grouped_rel->agg_info->apply_at))
+   if (!bms_equal(apply_agg_at, grouped_rel->agg_info->apply_agg_at))
    {
-       if (bms_is_subset(agg_apply_at, grouped_rel->agg_info->apply_at))
+       if (bms_is_subset(apply_agg_at, grouped_rel->agg_info->apply_agg_at))
        {
            /* Adjust the size estimates for the grouped join relation. */
            set_joinrel_size_estimates(root, grouped_rel,
                                       rel1_empty ? rel1 : grouped_rel1,
                                       rel2_empty ? rel2 : grouped_rel2,
                                       sjinfo, restrictlist);
-           grouped_rel->agg_info->apply_at = agg_apply_at;
+           grouped_rel->agg_info->apply_agg_at = apply_agg_at;
        }
        else
            return;
index cf1bc6721370097ec4b205ef943606d551c60342..1158bc194c31102f8435e65a3902209542106366 100644 (file)
@@ -462,7 +462,7 @@ build_simple_grouped_rel(PlannerInfo *root, RelOptInfo *rel)
        return NULL;
 
    /* Track the set of relids at which partial aggregation is applied */
-   agg_info->apply_at = bms_copy(rel->relids);
+   agg_info->apply_agg_at = bms_copy(rel->relids);
 
    /* build the grouped relation */
    grouped_rel = build_grouped_rel(root, rel);
@@ -2692,7 +2692,7 @@ create_rel_agg_info(PlannerInfo *root, RelOptInfo *rel,
                                              rel,
                                              rel->top_parent);
 
-       agg_info->apply_at = NULL;  /* caller will change this later */
+       agg_info->apply_agg_at = NULL;  /* caller will change this later */
 
        if (calculate_grouped_rows)
        {
@@ -2759,7 +2759,7 @@ create_rel_agg_info(PlannerInfo *root, RelOptInfo *rel,
    result->agg_input = agg_input;
    result->group_clauses = group_clauses;
    result->group_exprs = group_exprs;
-   result->apply_at = NULL;    /* caller will change this later */
+   result->apply_agg_at = NULL;    /* caller will change this later */
 
    if (calculate_grouped_rows)
    {
index 79408743166019b4ba8541d55033ac76b4bdb82f..01dbbca275340cde705650704a9cf193638b0704 100644 (file)
@@ -1178,8 +1178,8 @@ typedef struct RelOptInfo
  * "group_clauses" and "group_exprs" are lists of SortGroupClauses and the
  * corresponding grouping expressions.
  *
- * "apply_at" tracks the set of relids at which partial aggregation is applied
- * in the paths of this grouped relation.
+ * "apply_agg_at" tracks the set of relids at which partial aggregation is
+ * applied in the paths of this grouped relation.
  *
  * "grouped_rows" is the estimated number of result tuples of the grouped
  * relation.
@@ -1206,7 +1206,7 @@ typedef struct RelAggInfo
    List       *group_exprs;
 
    /* the set of relids partial aggregation is applied at */
-   Relids      apply_at;
+   Relids      apply_agg_at;
 
    /* estimated number of result tuples */
    Cardinality grouped_rows;