1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-19 15:49:24 +03:00

Rename apply_at to apply_agg_at for clarity

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
This commit is contained in:
Richard Guo
2025-10-14 16:35:22 +09:00
parent a7d8052910
commit 1206df04c2
4 changed files with 18 additions and 18 deletions

View 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;

View 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;

View 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)
{

View 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;