static bool
can_partial_agg(PlannerInfo *root)
{
Query *parse = root->parse;
if (!parse->hasAggs && root->groupClause == NIL)
{
/*
* We don't know how to do parallel aggregation unless we have either
* some aggregates or a grouping clause.
*/
return false;
}
else if (parse->groupingSets)
{
return false;
}
else if (root->hasNonPartialAggs || root->hasNonSerialAggs)
{
return false;
}
return true;
}
while reviewing other patches,
i am wondering should we change
"if (!parse->hasAggs && parse->groupClause == NIL)"
to
"if (!parse->hasAggs && root->processed_groupClause == NIL)"
root->processed_groupClause same as parse->groupClause
but removed some not necessary groupby logic,
e.g. "group by 1 = 1" cases.
so that in some corner cases, GroupPathExtraData->flags are properly set.
contrived corner case:
select 1 from t0 group by 1= 1;