diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index ec27c1a4994..9c6436eb72f 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -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; diff --git a/src/backend/optimizer/path/joinrels.c b/src/backend/optimizer/path/joinrels.c index 43b84d239ed..5d1fc3899da 100644 --- a/src/backend/optimizer/path/joinrels.c +++ b/src/backend/optimizer/path/joinrels.c @@ -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; diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c index cf1bc672137..1158bc194c3 100644 --- a/src/backend/optimizer/util/relnode.c +++ b/src/backend/optimizer/util/relnode.c @@ -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) { diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h index 79408743166..01dbbca2753 100644 --- a/src/include/nodes/pathnodes.h +++ b/src/include/nodes/pathnodes.h @@ -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;