static bool is_degenerate_grouping(PlannerInfo *root);
static void create_degenerate_grouping_paths(PlannerInfo *root,
RelOptInfo *input_rel,
- PathTarget *target, RelOptInfo *grouped_rel);
+ RelOptInfo *grouped_rel);
static void create_ordinary_grouping_paths(PlannerInfo *root,
RelOptInfo *input_rel,
- PathTarget *target, RelOptInfo *grouped_rel,
+ RelOptInfo *grouped_rel,
const AggClauseCosts *agg_costs,
grouping_sets_data *gd, int flags);
static void consider_groupingsets_paths(PlannerInfo *root,
Path *path,
bool is_sorted,
bool can_hash,
- PathTarget *target,
grouping_sets_data *gd,
const AggClauseCosts *agg_costs,
double dNumGroups);
List *targets, List *targets_contain_srfs);
static void add_paths_to_grouping_rel(PlannerInfo *root, RelOptInfo *input_rel,
RelOptInfo *grouped_rel,
- PathTarget *target,
RelOptInfo *partially_grouped_rel,
const AggClauseCosts *agg_costs,
const AggClauseCosts *agg_final_costs,
* grouping, as appropriate.
*/
if (is_degenerate_grouping(root))
- create_degenerate_grouping_paths(root, input_rel, target, grouped_rel);
+ create_degenerate_grouping_paths(root, input_rel, grouped_rel);
else
{
int flags = 0;
if (can_partial_agg(root, agg_costs))
flags |= GROUPING_CAN_PARTIAL_AGG;
- create_ordinary_grouping_paths(root, input_rel, target, grouped_rel,
+ create_ordinary_grouping_paths(root, input_rel, grouped_rel,
agg_costs, gd, flags);
}
*/
static void
create_degenerate_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
- PathTarget *target, RelOptInfo *grouped_rel)
+ RelOptInfo *grouped_rel)
{
Query *parse = root->parse;
int nrows;
{
path = (Path *)
create_result_path(root, grouped_rel,
- target,
+ grouped_rel->reltarget,
(List *) parse->havingQual);
paths = lappend(paths, path);
}
false,
NIL,
-1);
- path->pathtarget = target;
}
else
{
/* No grouping sets, or just one, so one output row */
path = (Path *)
create_result_path(root, grouped_rel,
- target,
+ grouped_rel->reltarget,
(List *) parse->havingQual);
}
*/
static void
create_ordinary_grouping_paths(PlannerInfo *root, RelOptInfo *input_rel,
- PathTarget *target, RelOptInfo *grouped_rel,
+ RelOptInfo *grouped_rel,
const AggClauseCosts *agg_costs,
grouping_sets_data *gd, int flags)
{
}
/* Build final grouping paths */
- add_paths_to_grouping_rel(root, input_rel, grouped_rel, target,
+ add_paths_to_grouping_rel(root, input_rel, grouped_rel,
partially_grouped_rel, agg_costs,
&agg_final_costs, gd, can_sort, can_hash,
dNumGroups, (List *) parse->havingQual);
Path *path,
bool is_sorted,
bool can_hash,
- PathTarget *target,
grouping_sets_data *gd,
const AggClauseCosts *agg_costs,
double dNumGroups)
create_groupingsets_path(root,
grouped_rel,
path,
- target,
(List *) parse->havingQual,
strat,
new_rollups,
create_groupingsets_path(root,
grouped_rel,
path,
- target,
(List *) parse->havingQual,
AGG_MIXED,
rollups,
create_groupingsets_path(root,
grouped_rel,
path,
- target,
(List *) parse->havingQual,
AGG_SORTED,
gd->rollups,
static void
add_paths_to_grouping_rel(PlannerInfo *root, RelOptInfo *input_rel,
RelOptInfo *grouped_rel,
- PathTarget *target,
RelOptInfo *partially_grouped_rel,
const AggClauseCosts *agg_costs,
const AggClauseCosts *agg_final_costs,
if (parse->groupingSets)
{
consider_groupingsets_paths(root, grouped_rel,
- path, true, can_hash, target,
+ path, true, can_hash,
gd, agg_costs, dNumGroups);
}
else if (parse->hasAggs)
create_agg_path(root,
grouped_rel,
path,
- target,
+ grouped_rel->reltarget,
parse->groupClause ? AGG_SORTED : AGG_PLAIN,
AGGSPLIT_SIMPLE,
parse->groupClause,
create_group_path(root,
grouped_rel,
path,
- target,
parse->groupClause,
havingQual,
dNumGroups));
create_agg_path(root,
grouped_rel,
path,
- target,
+ grouped_rel->reltarget,
parse->groupClause ? AGG_SORTED : AGG_PLAIN,
AGGSPLIT_FINAL_DESERIAL,
parse->groupClause,
create_group_path(root,
grouped_rel,
path,
- target,
parse->groupClause,
havingQual,
dNumGroups));
* Try for a hash-only groupingsets path over unsorted input.
*/
consider_groupingsets_paths(root, grouped_rel,
- cheapest_path, false, true, target,
+ cheapest_path, false, true,
gd, agg_costs, dNumGroups);
}
else
add_path(grouped_rel, (Path *)
create_agg_path(root, grouped_rel,
cheapest_path,
- target,
+ grouped_rel->reltarget,
AGG_HASHED,
AGGSPLIT_SIMPLE,
parse->groupClause,
create_agg_path(root,
grouped_rel,
path,
- target,
+ grouped_rel->reltarget,
AGG_HASHED,
AGGSPLIT_FINAL_DESERIAL,
parse->groupClause,
create_group_path(root,
partially_grouped_rel,
path,
- partially_grouped_rel->reltarget,
parse->groupClause,
NIL,
dNumPartialGroups));