This is an automated email from the ASF dual-hosted git repository.

chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/cbdb-postgres-merge by this 
push:
     new f233b9773a3 Use parse->groupClause to determine if it is a plainagg
f233b9773a3 is described below

commit f233b9773a3dd1c4beebf0b6d66a9bb354cd83ab
Author: Jinbao Chen <[email protected]>
AuthorDate: Thu Jan 15 10:44:08 2026 +0800

    Use parse->groupClause to determine if it is a plainagg
---
 src/backend/cdb/cdbgroupingpaths.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/backend/cdb/cdbgroupingpaths.c 
b/src/backend/cdb/cdbgroupingpaths.c
index f682b359ffe..b9f9d26b0ed 100644
--- a/src/backend/cdb/cdbgroupingpaths.c
+++ b/src/backend/cdb/cdbgroupingpaths.c
@@ -88,6 +88,7 @@ typedef struct
        /* From the Query */
        bool            hasAggs;
        bool            hasDistinctOn;
+       List       *parseGroupClause;   /* a list of SortGroupClause's */
        List       *groupClause;        /* a list of SortGroupClause's */
        List       *groupingSets;       /* a list of GroupingSet's if present */
        List       *group_tles;
@@ -314,6 +315,7 @@ cdb_create_multistage_grouping_paths(PlannerInfo *root,
 
        ctx.hasAggs = parse->hasAggs;
        ctx.hasDistinctOn = parse->hasDistinctOn;
+       ctx.parseGroupClause = parse->groupClause;
        ctx.groupClause = root->processed_groupClause;
        ctx.groupingSets = parse->groupingSets;
        ctx.havingQual = havingQual;
@@ -623,6 +625,7 @@ cdb_create_twostage_distinct_paths(PlannerInfo *root,
        ctx.hasDistinctOn = true;
        ctx.groupingSets = NIL;
        ctx.havingQual = NULL;
+       ctx.parseGroupClause = parse->distinctClause;
        ctx.groupClause = parse->distinctClause;
        ctx.group_tles = get_common_group_tles(target, parse->distinctClause, 
NIL);
        ctx.final_groupClause = ctx.groupClause;
@@ -1056,7 +1059,7 @@ add_first_stage_group_agg_path(PlannerInfo *root,
                                                                         
ctx->partial_rel,
                                                                         path,
                                                                         
ctx->partial_grouping_target,
-                                                                        
ctx->groupClause ? AGG_SORTED : AGG_PLAIN,
+                                                                        
ctx->parseGroupClause ? AGG_SORTED : AGG_PLAIN,
                                                                         
ctx->hasAggs ? AGGSPLIT_INITIAL_SERIAL : AGGSPLIT_SIMPLE,
                                                                         false, 
/* streaming */
                                                                         
ctx->groupClause,
@@ -1136,7 +1139,7 @@ add_second_stage_group_agg_path(PlannerInfo *root,
                                                                                
output_rel,
                                                                                
path,
                                                                                
ctx->target,
-                                                                               
(ctx->final_groupClause ? AGG_SORTED : AGG_PLAIN),
+                                                                               
(ctx->parseGroupClause ? AGG_SORTED : AGG_PLAIN),
                                                                                
ctx->hasAggs ? AGGSPLIT_FINAL_DESERIAL : AGGSPLIT_SIMPLE,
                                                                                
false, /* streaming */
                                                                                
ctx->final_groupClause,
@@ -1174,7 +1177,7 @@ add_second_stage_group_agg_path(PlannerInfo *root,
                                                                output_rel,
                                                                path,
                                                                ctx->target,
-                                                               
(ctx->final_groupClause ? AGG_SORTED : AGG_PLAIN),
+                                                               
(ctx->parseGroupClause ? AGG_SORTED : AGG_PLAIN),
                                                                ctx->hasAggs ? 
AGGSPLIT_FINAL_DESERIAL : AGGSPLIT_SIMPLE,
                                                                false, /* 
streaming */
                                                                
ctx->final_groupClause,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to