OSDN Git Service

Up to date with 10 beta 2
authorKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Thu, 27 Jul 2017 10:07:55 +0000 (19:07 +0900)
committerKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Thu, 27 Jul 2017 10:13:22 +0000 (19:13 +0900)
Make copied code to be up to date with the core as of 10 beta 2.

core.c
make_join_rel.c

diff --git a/core.c b/core.c
index aa8d868..d78858c 100644 (file)
--- a/core.c
+++ b/core.c
@@ -194,14 +194,14 @@ add_paths_to_append_rel(PlannerInfo *root, RelOptInfo *rel,
                 */
                if (childrel->cheapest_total_path->param_info == NULL)
                        subpaths = accumulate_append_subpath(subpaths,
-                                                                                         childrel->cheapest_total_path);
+                                                                                                childrel->cheapest_total_path);
                else
                        subpaths_valid = false;
 
                /* Same idea, but for a partial plan. */
                if (childrel->partial_pathlist != NIL)
                        partial_subpaths = accumulate_append_subpath(partial_subpaths,
-                                                                          linitial(childrel->partial_pathlist));
+                                                                                                                linitial(childrel->partial_pathlist));
                else
                        partial_subpaths_valid = false;
 
@@ -758,7 +758,7 @@ join_search_one_level(PlannerInfo *root, int level)
 
                        if (level == 2)         /* consider remaining initial rels */
                                other_rels = lnext(r);
-                       else    /* consider all initial rels */
+                       else                            /* consider all initial rels */
                                other_rels = list_head(joinrels[1]);
 
                        make_rels_by_clause_joins(root,
@@ -1282,7 +1282,7 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
                                                !bms_is_subset(sjinfo->min_righthand, join_plus_rhs))
                                        {
                                                join_plus_rhs = bms_add_members(join_plus_rhs,
-                                                                                                         sjinfo->min_righthand);
+                                                                                                               sjinfo->min_righthand);
                                                more = true;
                                        }
                                        /* full joins constrain both sides symmetrically */
@@ -1455,3 +1455,4 @@ restriction_is_constant_false(List *restrictlist, bool only_pushed_down)
        }
        return false;
 }
+
index 94bbfb8..ac8e0c2 100644 (file)
  *-------------------------------------------------------------------------
  */
 
+static void populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1,
+                                                                               RelOptInfo *rel2, RelOptInfo *joinrel,
+                                                                               SpecialJoinInfo *sjinfo,
+                                                                               List *restrictlist);
 /*
  * adjust_rows: tweak estimated row numbers according to the hint.
 */
@@ -208,6 +212,27 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
                return joinrel;
        }
 
+       /* Add paths to the join relation. */
+       populate_joinrel_with_paths(root, rel1, rel2, joinrel, sjinfo,
+                                                               restrictlist);
+
+       bms_free(joinrelids);
+
+       return joinrel;
+}
+
+/*
+ * populate_joinrel_with_paths
+ *       Add paths to the given joinrel for given pair of joining relations. The
+ *       SpecialJoinInfo provides details about the join and the restrictlist
+ *       contains the join clauses and the other clauses applicable for given pair
+ *       of the joining relations.
+ */
+static void
+populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1,
+                                                       RelOptInfo *rel2, RelOptInfo *joinrel,
+                                                       SpecialJoinInfo *sjinfo, List *restrictlist)
+{
        /*
         * Consider paths using each rel as both outer and inner.  Depending on
         * the join type, a provably empty outer or inner rel might mean the join
@@ -352,8 +377,4 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
                        elog(ERROR, "unrecognized join type: %d", (int) sjinfo->jointype);
                        break;
        }
-
-       bms_free(joinrelids);
-
-       return joinrel;
 }