MCPcopy Create free account
hub / github.com/apache/cloudberry / try_partial_nestloop_path

Function try_partial_nestloop_path

src/backend/optimizer/path/joinpath.c:835–921  ·  view source on GitHub ↗

* try_partial_nestloop_path * Consider a partial nestloop join path; if it appears useful, push it into * the joinrel's partial_pathlist via add_partial_path(). */

Source from the content-addressed store, hash-verified

833 * the joinrel's partial_pathlist via add_partial_path().
834 */
835static void
836try_partial_nestloop_path(PlannerInfo *root,
837 RelOptInfo *joinrel,
838 Path *outer_path,
839 Path *inner_path,
840 List *pathkeys,
841 JoinType jointype,
842 JoinType orig_jointype,
843 JoinPathExtraData *extra)
844{
845 JoinCostWorkspace workspace;
846 Path *nestloop_path;
847
848 /*
849 * If the inner path is parameterized, the parameterization must be fully
850 * satisfied by the proposed outer path. Parameterized partial paths are
851 * not supported. The caller should already have verified that no lateral
852 * rels are required here.
853 */
854 Assert(bms_is_empty(joinrel->lateral_relids));
855 if (inner_path->param_info != NULL)
856 {
857 Relids inner_paramrels = inner_path->param_info->ppi_req_outer;
858 RelOptInfo *outerrel = outer_path->parent;
859 Relids outerrelids;
860
861 /*
862 * The inner and outer paths are parameterized, if at all, by the top
863 * level parents, not the child relations, so we must use those relids
864 * for our parameterization tests.
865 */
866 if (outerrel->top_parent_relids)
867 outerrelids = outerrel->top_parent_relids;
868 else
869 outerrelids = outerrel->relids;
870
871 if (!bms_is_subset(inner_paramrels, outerrelids))
872 return;
873 }
874
875 /*
876 * Before creating a path, get a quick lower bound on what it is likely to
877 * cost. Bail out right away if it looks terrible.
878 */
879 initial_cost_nestloop(root, &workspace, jointype,
880 outer_path, inner_path, extra);
881 if (!add_partial_path_precheck(joinrel, workspace.total_cost, pathkeys))
882 return;
883
884 /*
885 * If the inner path is parameterized, it is parameterized by the topmost
886 * parent of the outer rel, not the outer rel itself. Fix that.
887 */
888 if (PATH_PARAM_BY_PARENT(inner_path, outer_path->parent))
889 {
890 inner_path = reparameterize_path_by_child(root, inner_path,
891 outer_path->parent);
892

Callers 1

Calls 7

bms_is_emptyFunction · 0.85
bms_is_subsetFunction · 0.85
initial_cost_nestloopFunction · 0.85
create_nestloop_pathFunction · 0.85
add_partial_pathFunction · 0.85

Tested by

no test coverage detected