can_partial_agg use root->processed_groupClause instead of parse->groupClause - Mailing list pgsql-hackers

From jian he
Subject can_partial_agg use root->processed_groupClause instead of parse->groupClause
Date
Msg-id CACJufxH=r9WiBNfyi7hWADRLf9LqKmP02CaG-+Aff6mOaL9TiQ@mail.gmail.com
Whole thread Raw
List pgsql-hackers
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;



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Pgoutput not capturing the generated columns
Next
From: jian he
Date:
Subject: Re: general purpose array_sort