Distribution *outerd = pathnode->outerjoinpath->distribution;
Distribution *targetd;
List *alternate = NIL;
+ List *restrictClauses = NIL;
/* Catalog join */
if (innerd == NULL && outerd == NULL)
}
+ restrictClauses = list_copy(pathnode->joinrestrictinfo);
+ restrictClauses = list_concat(restrictClauses,
+ pathnode->movedrestrictinfo);
+
/*
* This join is still allowed if inner and outer paths have
* equivalent distribution and joined along the distribution keys.
* Equivalence Class.
* Try to figure out if such restriction exists.
*/
- foreach(lc, pathnode->joinrestrictinfo)
+ foreach(lc, restrictClauses)
{
RestrictInfo *ri = (RestrictInfo *) lfirst(lc);
ListCell *emc;
* 1. one argument is already a partitioning key of one subplan.
* 2. restriction is cheaper to calculate
*/
- foreach(lc, pathnode->joinrestrictinfo)
+ foreach(lc, restrictClauses)
{
RestrictInfo *ri = (RestrictInfo *) lfirst(lc);
#ifdef XCP
List *alternate;
ListCell *lc;
+ List *mclauses = NIL;
#endif
Relids inner_req_outer = PATH_REQ_OUTER(inner_path);
inner_path->parent->relids,
inner_and_outer))
jclauses = lappend(jclauses, rinfo);
+#ifdef XCP
+ else
+ mclauses = lappend(mclauses, rinfo);
+#endif
}
restrict_clauses = jclauses;
}
pathnode->joinrestrictinfo = restrict_clauses;
#ifdef XCP
+ pathnode->movedrestrictinfo = mclauses;
+
alternate = set_joinpath_distribution(root, pathnode);
#endif
final_cost_nestloop(root, pathnode, workspace, sjinfo, semifactors);