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

avamingli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 9a9908688fea51b5f5330186189bf17090e314dc
Author: QingMa <[email protected]>
AuthorDate: Mon May 29 13:44:24 2023 +0800

    Remove fixme in prepunion.c:848 (#15595)
    
    If `optype` is equal to `PSETOP_PARALLEL_PARTITIONED`, 
`generate_nonunion_paths` will
    invoke `make_motion_hash_all_targets` twice for certain subpaths. This 
won't generate
    incorrect query plans now because the target locus and subpath locus are 
equal, the
    second invocation of `make_motion_hash_all_targets` won't add new motion on 
top of
    the existing motion. This commit removes the GPDB_96_MERGE_FIXME and 
performs some
    simple refactoring to make the code logic clearer.
---
 src/backend/cdb/cdbsetop.c             |  8 +++-----
 src/backend/optimizer/prep/prepunion.c | 33 ---------------------------------
 2 files changed, 3 insertions(+), 38 deletions(-)

diff --git a/src/backend/cdb/cdbsetop.c b/src/backend/cdb/cdbsetop.c
index 90b4cdf88b..cde90949e2 100644
--- a/src/backend/cdb/cdbsetop.c
+++ b/src/backend/cdb/cdbsetop.c
@@ -138,17 +138,15 @@ adjust_setop_arguments(PlannerInfo *root, List *pathlist, 
List *tlist_list, GpSe
                                        case CdbLocusType_Hashed:
                                        case CdbLocusType_HashedOJ:
                                        case CdbLocusType_Strewn:
-                                               break;
                                        case CdbLocusType_SingleQE:
                                        case CdbLocusType_General:
                                        case CdbLocusType_SegmentGeneral:
                                        case CdbLocusType_SegmentGeneralWorkers:
                                        case CdbLocusType_HashedWorkers:
                                                /*
-                                                * The setop itself will run on 
an N-gang, so we need
-                                                * to arrange for the singleton 
input to be separately
-                                                * dispatched to a 1-gang and 
collect its result on
-                                                * one of our N QEs. Hence ...
+                                                * Collocate non-distinct 
tuples prior to sort or hash. We must
+                                                * put the Redistribute nodes 
below the Append, otherwise we lose
+                                                * the order of the firstFlags.
                                                 */
                                                adjusted_path = 
make_motion_hash_all_targets(root, subpath, subtlist);
                                                break;
diff --git a/src/backend/optimizer/prep/prepunion.c 
b/src/backend/optimizer/prep/prepunion.c
index 62e7f40867..6ec2a00883 100644
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -831,39 +831,6 @@ generate_nonunion_paths(SetOperationStmt *op, PlannerInfo 
*root,
                optype = PSETOP_SEQUENTIAL_QD;
        }
 
-       if ( optype == PSETOP_PARALLEL_PARTITIONED )
-       {
-               /*
-                * CDB: Collocate non-distinct tuples prior to sort or hash. We 
must
-                * put the Redistribute nodes below the Append, otherwise we 
lose
-                * the order of the firstFlags.
-                */
-               ListCell   *pathcell;
-               ListCell   *tlistcell;
-               List       *newpathlist = NIL;
-
-               forboth(pathcell, pathlist, tlistcell, tlist_list)
-               {
-                       Path       *subpath = (Path *) lfirst(pathcell);
-                       List       *subtlist = (List *) lfirst(tlistcell);
-#if 0
-                       /* GPDB_96_MERGE_FIXME */
-                       /*
-                        * If the subplan already has a Motion at the top, peel 
it off
-                        * first, so that we don't have a Motion on top of a 
Motion.
-                        * That would be silly. I wish we could be smarter and 
not
-                        * create such a Motion in the first place, but it's 
too late
-                        * for that here.
-                        */
-                       while (IsA(subpath, Motion))
-                               subpath = subpath->lefttree;
-#endif
-                       newpathlist = lappend(newpathlist,
-                                                                 
make_motion_hash_all_targets(root, subpath, subtlist));
-               }
-               pathlist = newpathlist;
-       }
-
        /*
         * Generate tlist for Append plan node.
         *


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

Reply via email to