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 6c40002b688 Fix some compile errors for optimizer
6c40002b688 is described below

commit 6c40002b688df066cc0d017bd350d5f5a8c0a771
Author: Jinbao Chen <[email protected]>
AuthorDate: Thu Sep 25 22:17:11 2025 +0800

    Fix some compile errors for optimizer
---
 src/backend/optimizer/path/equivclass.c |  3 +--
 src/backend/optimizer/path/joinrels.c   |  4 ++--
 src/backend/optimizer/path/pathkeys.c   | 12 +++++-------
 src/backend/optimizer/plan/createplan.c | 25 ++++++++++++-------------
 src/backend/optimizer/plan/initsplan.c  | 12 ++++--------
 src/include/nodes/nodes.h               |  4 ++++
 src/include/nodes/pathnodes.h           |  2 +-
 src/include/optimizer/optimizer.h       |  1 -
 src/include/optimizer/paths.h           |  1 -
 src/include/optimizer/planmain.h        |  4 ++--
 10 files changed, 31 insertions(+), 37 deletions(-)

diff --git a/src/backend/optimizer/path/equivclass.c 
b/src/backend/optimizer/path/equivclass.c
index 4c7e6866cfd..ddaa9cc9b8a 100644
--- a/src/backend/optimizer/path/equivclass.c
+++ b/src/backend/optimizer/path/equivclass.c
@@ -732,7 +732,6 @@ get_eclass_for_sort_expr(PlannerInfo *root,
                        }
 
                        Assert(rel->reloptkind == RELOPT_BASEREL ||
-                                  rel->reloptkind == RELOPT_DEADREL ||
                                   rel->reloptkind == RELOPT_OTHER_MEMBER_REL);
 
                        rel->eclass_indexes = 
bms_add_member(rel->eclass_indexes,
@@ -3263,7 +3262,7 @@ translate_expr_to_rel_vars(PlannerInfo *root, 
GroupedVarInfo *gvi,
                ListCell   *l2;
 
                /* These EC kind should be ignored. */
-               if (ec->ec_has_volatile || ec->ec_below_outer_join || 
ec->ec_broken)
+               if (ec->ec_has_volatile || ec->ec_broken)
                        continue;
 
                /* Single-element EC can hardly help in translations. */
diff --git a/src/backend/optimizer/path/joinrels.c 
b/src/backend/optimizer/path/joinrels.c
index 4ea5a36da96..b8e37e7f60a 100644
--- a/src/backend/optimizer/path/joinrels.c
+++ b/src/backend/optimizer/path/joinrels.c
@@ -864,7 +864,7 @@ make_grouped_join_rel(PlannerInfo *root, RelOptInfo *rel1, 
RelOptInfo *rel2,
                agg_info->build_from_plain = true;
                joinrel = agg_info->rel_grouped;
                if (joinrel == NULL)
-                       joinrel = build_join_rel(root, joinrelids, rel1, rel2, 
sjinfo,
+                       joinrel = build_join_rel(root, joinrelids, rel1, rel2, 
sjinfo, NIL,
                                                                         
&restrictlist, agg_info);
                generate_grouping_paths(root, joinrel, joinrel_plain, agg_info);
                if (joinrel->pathlist != NIL || joinrel->partial_pathlist != 
NIL)
@@ -906,7 +906,7 @@ make_grouped_join_rel(PlannerInfo *root, RelOptInfo *rel1, 
RelOptInfo *rel2,
                agg_info->build_from_plain = false;
                joinrel = agg_info->rel_grouped_non_plain;
                if (joinrel == NULL)
-                       joinrel = build_join_rel(root, joinrelids, rel1, rel2, 
sjinfo,
+                       joinrel = build_join_rel(root, joinrelids, rel1, rel2, 
sjinfo, NIL,
                                                                         
&restrictlist, agg_info);
 
                populate_joinrel_with_paths(root, rel1, rel2, joinrel, sjinfo,
diff --git a/src/backend/optimizer/path/pathkeys.c 
b/src/backend/optimizer/path/pathkeys.c
index c22bcbbbecb..8f2e38eb5e8 100644
--- a/src/backend/optimizer/path/pathkeys.c
+++ b/src/backend/optimizer/path/pathkeys.c
@@ -174,12 +174,13 @@ gen_implied_qual(PlannerInfo *root,
        new_rinfo = make_restrictinfo(root,
                                                                  (Expr *) 
new_clause,
                                                                  
old_rinfo->is_pushed_down,
-                                                                 
old_rinfo->outerjoin_delayed,
+                                                                 
old_rinfo->has_clone,
+                                                                 
old_rinfo->is_clone,
                                                                  
old_rinfo->pseudoconstant,
                                                                  
old_rinfo->security_level,
                                                                  new_qualscope,
-                                                                 
old_rinfo->outer_relids,
-                                                                 
old_rinfo->nullable_relids);
+                                                                 
old_rinfo->incompatible_relids,
+                                                                 
old_rinfo->outer_relids);
        check_mergejoinable(new_rinfo);
        check_hashjoinable(new_rinfo);
 
@@ -195,7 +196,7 @@ gen_implied_qual(PlannerInfo *root,
                                                                                
   PVC_RECURSE_AGGREGATES |
                                                                                
   PVC_INCLUDE_PLACEHOLDERS);
 
-               add_vars_to_targetlist(root, vars, new_qualscope, false);
+               add_vars_to_targetlist(root, vars, new_qualscope);
                list_free(vars);
        }
 
@@ -1509,7 +1510,6 @@ cdb_make_distkey_for_expr(PlannerInfo *root,
         * used for DistributionKey, so it would not participate in qual 
deduction.
         */
        eclass = get_eclass_for_sort_expr(root, (Expr *) expr,
-                                                                         NULL,
                                                                          
mergeopfamilies,
                                                                          
lefttype,
                                                                          
exprCollation(expr),
@@ -1625,7 +1625,6 @@ cdb_pull_up_eclass(PlannerInfo *root,
         */
        outer_ec = get_eclass_for_sort_expr(root,
                                                                                
newexpr,
-                                                                               
NULL,
                                                                                
eclass->ec_opfamilies,
                                                                                
exprType((Node *) newexpr),
                                                                                
exprCollation((Node *) newexpr),
@@ -1782,7 +1781,6 @@ make_distribution_exprs_for_groupclause(PlannerInfo 
*root, List *groupclause, Li
 
                pathkey = make_pathkey_from_sortop(root,
                                                                                
   expr,
-                                                                               
   root->nullable_baserels,
                                                                                
   sortcl->sortop,
                                                                                
   sortcl->nulls_first,
                                                                                
   sortcl->tleSortGroupRef,
diff --git a/src/backend/optimizer/plan/createplan.c 
b/src/backend/optimizer/plan/createplan.c
index 932a4552b63..af918fb9640 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -318,7 +318,6 @@ static IncrementalSort 
*make_incrementalsort_from_pathkeys(Plan *lefttree,
 static Sort *make_sort_from_groupcols(List *groupcls,
                                                                          
AttrNumber *grpColIdx,
                                                                          Plan 
*lefttree);
-static Material *make_material(Plan *lefttree);
 static Memoize *make_memoize(Plan *lefttree, Oid *hashoperators,
                                                         Oid *collations, List 
*param_exprs,
                                                         bool singlerow, bool 
binary_mode,
@@ -5271,7 +5270,7 @@ create_nestloop_plan(PlannerInfo *root,
        bool            partition_selectors_created;
        bool            prefetch = false;
 
-       push_partition_selector_candidate_for_join(root, best_path);
+       push_partition_selector_candidate_for_join(root, &best_path->jpath);
 
 #if  0
        /*
@@ -5293,7 +5292,7 @@ create_nestloop_plan(PlannerInfo *root,
         * inject Partition Selectors to the inner side.
         */
        partition_selectors_created =
-               pop_and_inject_partition_selectors(root, best_path);
+               pop_and_inject_partition_selectors(root, &best_path->jpath);
 
        /* For a nestloop, include outer relids in curOuterRels for inner side 
*/
        root->curOuterRels = bms_union(root->curOuterRels,
@@ -5312,8 +5311,8 @@ create_nestloop_plan(PlannerInfo *root,
         * NOTE: materialize_finished_plan() does *almost* what we want -- 
except
         * we aren't finished.
         */
-       if (best_path->innerjoinpath->motionHazard ||
-               !best_path->innerjoinpath->rescannable)
+       if (best_path->jpath.innerjoinpath->motionHazard ||
+               !best_path->jpath.innerjoinpath->rescannable)
        {
                Plan       *p;
                Material   *mat;
@@ -5351,7 +5350,7 @@ create_nestloop_plan(PlannerInfo *root,
                 * MPP-1657: Even if there is already a materialize here, we
                 * may need to update its strictness.
                 */
-               if (best_path->outerjoinpath->motionHazard)
+               if (best_path->jpath.outerjoinpath->motionHazard)
                {
                        mat->cdb_strict = true;
                        prefetch = true;
@@ -5380,7 +5379,7 @@ create_nestloop_plan(PlannerInfo *root,
                otherclauses = NIL;
        }
 
-       if (best_path->jointype == JOIN_LASJ_NOTIN)
+       if (best_path->jpath.jointype == JOIN_LASJ_NOTIN)
        {
                joinclauses = remove_isnotfalse(joinclauses);
        }
@@ -5412,9 +5411,9 @@ create_nestloop_plan(PlannerInfo *root,
 
        copy_generic_path_info(&join_plan->join.plan, &best_path->jpath.path);
 
-       if (IsA(best_path->innerjoinpath, MaterialPath))
+       if (IsA(best_path->jpath.innerjoinpath, MaterialPath))
        {
-               MaterialPath *mp = (MaterialPath *) best_path->innerjoinpath;
+               MaterialPath *mp = (MaterialPath *) 
best_path->jpath.innerjoinpath;
 
                if (mp->cdb_strict)
                        prefetch = true;
@@ -5439,16 +5438,16 @@ create_nestloop_plan(PlannerInfo *root,
         *
         * See ExecPrefetchJoinQual() for details.
         */
-       if (best_path->outerjoinpath &&
-               best_path->outerjoinpath->motionHazard &&
+       if (best_path->jpath.outerjoinpath &&
+               best_path->jpath.outerjoinpath->motionHazard &&
                join_plan->join.joinqual != NIL)
                join_plan->join.prefetch_joinqual = true;
 
        /*
         * Similar for non join qual.
         */
-       if (best_path->outerjoinpath &&
-               best_path->outerjoinpath->motionHazard &&
+       if (best_path->jpath.outerjoinpath &&
+               best_path->jpath.outerjoinpath->motionHazard &&
                join_plan->join.plan.qual != NIL)
                join_plan->join.prefetch_qual = true;
 
diff --git a/src/backend/optimizer/plan/initsplan.c 
b/src/backend/optimizer/plan/initsplan.c
index b1a779f5529..8b29d23a032 100644
--- a/src/backend/optimizer/plan/initsplan.c
+++ b/src/backend/optimizer/plan/initsplan.c
@@ -138,8 +138,6 @@ static void distribute_qual_to_rels(PlannerInfo *root, Node 
*clause,
                                                                        List 
**postponed_oj_qual_list);
 static bool check_redundant_nullability_qual(PlannerInfo *root, Node *clause);
 static Relids get_join_domain_min_rels(PlannerInfo *root, Relids 
domain_relids);
-static void check_mergejoinable(RestrictInfo *restrictinfo);
-static void check_hashjoinable(RestrictInfo *restrictinfo);
 static void check_memoizable(RestrictInfo *restrictinfo);
 
 
@@ -287,7 +285,7 @@ build_base_rel_tlists(PlannerInfo *root, List *final_tlist)
                if (window_vars != NIL)
                {
                        add_vars_to_targetlist(root, window_vars,
-                                                                  
bms_make_singleton(0), true);
+                                                                  
bms_make_singleton(0));
                        list_free(window_vars);
                }
        }
@@ -307,7 +305,7 @@ build_base_rel_tlists(PlannerInfo *root, List *final_tlist)
  */
 void
 add_vars_to_targetlist_x(PlannerInfo *root, List *vars,
-                                                Relids where_needed, bool 
create_new_ph, bool force)
+                                                Relids where_needed, bool 
force)
 {
        ListCell   *temp;
 
@@ -357,10 +355,9 @@ add_vars_to_targetlist_x(PlannerInfo *root, List *vars,
        }
 }
 void
-add_vars_to_targetlist(PlannerInfo *root, List *vars, Bitmapset *where_needed,
-                                          bool create_new_ph)
+add_vars_to_targetlist(PlannerInfo *root, List *vars, Bitmapset *where_needed)
 {
-       add_vars_to_targetlist_x(root, vars, where_needed, create_new_ph, 
false);
+       add_vars_to_targetlist_x(root, vars, where_needed, false);
 }
 
 /*
@@ -2992,7 +2989,6 @@ distribute_restrictinfo_to_rels(PlannerInfo *root,
                                                                                
                   PVC_RECURSE_PLACEHOLDERS);
 
                                add_vars_to_targetlist_x(root, vars, relids,
-                                                                               
 false, /* create_new_ph */
                                                                                
 true /* force */);
                                list_free(vars);
 
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index 00ba1ce18dc..a61a77ea51a 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -354,6 +354,7 @@ typedef enum NodeTag
        T_IndexClause,
        T_PlaceHolderVar,
        T_SpecialJoinInfo,
+       T_OuterJoinClauseInfo,
        T_AppendRelInfo,
        T_RowIdentityVarInfo,
        T_PlaceHolderInfo,
@@ -361,9 +362,12 @@ typedef enum NodeTag
        T_MinMaxAggInfo,
        T_SegfileMapNode,
        T_PlannerParamItem,
+       T_AggInfo,
+       T_AggTransInfo,
        T_RollupData,
        T_GroupingSetData,
        T_StatisticExtInfo,
+       T_JoinDomain,
 
     /* Tags for MPP planner nodes (relation.h) */
     T_CdbMotionPath = 580,
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
index 636cf8a6850..1fd3bb2e5b0 100644
--- a/src/include/nodes/pathnodes.h
+++ b/src/include/nodes/pathnodes.h
@@ -1747,7 +1747,7 @@ typedef struct DistributionKey
  * This is copied from MUST_BE_REDUNDANT in pathkeys.c
  */
 #define CdbEquivClassIsConstant(eclass)                                        
        \
-       ((eclass)->ec_has_const && !(eclass)->ec_below_outer_join)
+       ((eclass)->ec_has_const)
 
 /*
  * VolatileFunctionStatus -- allows nodes to cache their
diff --git a/src/include/optimizer/optimizer.h 
b/src/include/optimizer/optimizer.h
index 047740823aa..e3473ccca7d 100644
--- a/src/include/optimizer/optimizer.h
+++ b/src/include/optimizer/optimizer.h
@@ -94,7 +94,6 @@ extern PGDLLIMPORT double parallel_setup_cost;
 extern PGDLLIMPORT double recursive_worktable_factor;
 extern PGDLLIMPORT int effective_cache_size;
 
-extern double clamp_row_est(double nrows);
 extern long clamp_cardinality_to_long(Cardinality x);
 
 /* in path/indxpath.c: */
diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h
index 5965372f582..a7af5e9ccb9 100644
--- a/src/include/optimizer/paths.h
+++ b/src/include/optimizer/paths.h
@@ -261,7 +261,6 @@ extern List *build_partition_pathkeys(PlannerInfo *root, 
RelOptInfo *partrel,
                                                                          
ScanDirection scandir, bool *partialkeys);
 extern PathKey *make_pathkey_from_sortop(PlannerInfo *root,
                                                                                
 Expr *expr,
-                                                                               
 Relids nullable_relids,
                                                                                
 Oid ordering_op,
                                                                                
 bool nulls_first,
                                                                                
 Index sortref,
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
index 592e45b47de..b7c86ad569e 100644
--- a/src/include/optimizer/planmain.h
+++ b/src/include/optimizer/planmain.h
@@ -112,9 +112,9 @@ extern void add_base_rels_to_query(PlannerInfo *root, Node 
*jtnode);
 extern void add_other_rels_to_query(PlannerInfo *root);
 extern void build_base_rel_tlists(PlannerInfo *root, List *final_tlist);
 extern void add_vars_to_targetlist(PlannerInfo *root, List *vars,
-                                                                  Relids 
where_needed, bool create_new_ph);
+                                                                  Relids 
where_needed);
 extern void add_vars_to_targetlist_x(PlannerInfo *root, List *vars,
-                                                                        Relids 
where_needed, bool create_new_ph,
+                                                                        Relids 
where_needed,
                                                                         bool 
force);
 extern void setup_aggregate_pushdown(PlannerInfo *root);
 extern void find_lateral_references(PlannerInfo *root);


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

Reply via email to