mirror of
https://github.com/postgres/postgres.git
synced 2025-11-18 02:02:55 +03:00
Rethink node-level representation of partial-aggregation modes.
The original coding had three separate booleans representing partial
aggregation behavior, which was confusing, unreadable, and error-prone,
not least because the booleans weren't always listed in the same order.
It was also inadequate for the allegedly-desirable future extension to
support intermediate partial aggregation, because we'd need separate
markers for serialization and deserialization in such a case.
Merge these bools into an enum "AggSplit" to provide symbolic names for
the supported operating modes (and document what those are). By assigning
the values of the enum constants carefully, we can treat AggSplit values
as options bitmasks so that tests of what to do aren't noticeably more
expensive than before.
While at it, get rid of Aggref.aggoutputtype. That's not needed since
commit 59a3795c2 got rid of setrefs.c's special-purpose Aggref comparison
code, and it likewise seemed more confusing than helpful.
Assorted comment cleanup as well (there's still more that I want to do
in that line).
catversion bump for change in Aggref node contents. Should be the last
one for partial-aggregation changes.
Discussion: <29309.1466699160@sss.pgh.pa.us>
This commit is contained in:
@@ -67,9 +67,8 @@ extern List *make_ands_implicit(Expr *clause);
|
||||
|
||||
extern PartialAggType aggregates_allow_partial(Node *clause);
|
||||
extern bool contain_agg_clause(Node *clause);
|
||||
extern void count_agg_clauses(PlannerInfo *root, Node *clause,
|
||||
AggClauseCosts *costs, bool finalizeAggs,
|
||||
bool combineStates, bool serialStates);
|
||||
extern void get_agg_clause_costs(PlannerInfo *root, Node *clause,
|
||||
AggSplit aggsplit, AggClauseCosts *costs);
|
||||
|
||||
extern bool contain_window_function(Node *clause);
|
||||
extern WindowFuncLists *find_window_functions(Node *clause, Index maxWinRef);
|
||||
|
||||
@@ -166,13 +166,11 @@ extern AggPath *create_agg_path(PlannerInfo *root,
|
||||
Path *subpath,
|
||||
PathTarget *target,
|
||||
AggStrategy aggstrategy,
|
||||
AggSplit aggsplit,
|
||||
List *groupClause,
|
||||
List *qual,
|
||||
const AggClauseCosts *aggcosts,
|
||||
double numGroups,
|
||||
bool combineStates,
|
||||
bool finalizeAggs,
|
||||
bool serialStates);
|
||||
double numGroups);
|
||||
extern GroupingSetsPath *create_groupingsets_path(PlannerInfo *root,
|
||||
RelOptInfo *rel,
|
||||
Path *subpath,
|
||||
|
||||
@@ -58,8 +58,8 @@ extern bool is_projection_capable_plan(Plan *plan);
|
||||
|
||||
/* External use of these functions is deprecated: */
|
||||
extern Sort *make_sort_from_sortclauses(List *sortcls, Plan *lefttree);
|
||||
extern Agg *make_agg(List *tlist, List *qual, AggStrategy aggstrategy,
|
||||
bool combineStates, bool finalizeAggs, bool serialStates,
|
||||
extern Agg *make_agg(List *tlist, List *qual,
|
||||
AggStrategy aggstrategy, AggSplit aggsplit,
|
||||
int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators,
|
||||
List *groupingSets, List *chain,
|
||||
double dNumGroups, Plan *lefttree);
|
||||
|
||||
@@ -46,7 +46,7 @@ extern bool is_dummy_plan(Plan *plan);
|
||||
extern RowMarkType select_rowmark_type(RangeTblEntry *rte,
|
||||
LockClauseStrength strength);
|
||||
|
||||
extern void mark_partial_aggref(Aggref *agg, bool serialize);
|
||||
extern void mark_partial_aggref(Aggref *agg, AggSplit aggsplit);
|
||||
|
||||
extern Path *get_cheapest_fractional_path(RelOptInfo *rel,
|
||||
double tuple_fraction);
|
||||
|
||||
Reference in New Issue
Block a user