Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2309eff

Browse files
author
Richard Guo
committed
Refactor the checks for parameterized partial paths
Parameterized partial paths are not supported, and we have several checks in try_partial_xxx_path functions to enforce this. For a partial nestloop join path, we need to ensure that if the inner path is parameterized, the parameterization is fully satisfied by the proposed outer path. For a partial merge/hashjoin join path, we need to ensure that the inner path is not parameterized. In all cases, we need to ensure that the outer path is not parameterized. However, the comment in try_partial_hashjoin_path does not describe this correctly. This patch fixes that. In addtion, this patch simplifies the checks peformed in try_partial_hashjoin_path and try_partial_mergejoin_path with the help of macro PATH_REQ_OUTER, and also adds asserts that the outer path is not parameterized in try_partial_xxx_path functions. Author: Richard Guo Discussion: https://postgr.es/m/CAMbWs48mKJ6g_GnYNa7dnw04MHaMK-jnAEBrMVhTp2uUg3Ut4A@mail.gmail.com
1 parent cc9daa0 commit 2309eff

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

src/backend/optimizer/path/joinpath.c

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,7 @@ try_partial_nestloop_path(PlannerInfo *root,
961961
* rels are required here.
962962
*/
963963
Assert(bms_is_empty(joinrel->lateral_relids));
964+
Assert(bms_is_empty(PATH_REQ_OUTER(outer_path)));
964965
if (inner_path->param_info != NULL)
965966
{
966967
Relids inner_paramrels = inner_path->param_info->ppi_req_outer;
@@ -1144,13 +1145,9 @@ try_partial_mergejoin_path(PlannerInfo *root,
11441145
* See comments in try_partial_hashjoin_path().
11451146
*/
11461147
Assert(bms_is_empty(joinrel->lateral_relids));
1147-
if (inner_path->param_info != NULL)
1148-
{
1149-
Relids inner_paramrels = inner_path->param_info->ppi_req_outer;
1150-
1151-
if (!bms_is_empty(inner_paramrels))
1152-
return;
1153-
}
1148+
Assert(bms_is_empty(PATH_REQ_OUTER(outer_path)));
1149+
if (!bms_is_empty(PATH_REQ_OUTER(inner_path)))
1150+
return;
11541151

11551152
/*
11561153
* If the given paths are already well enough ordered, we can skip doing
@@ -1286,19 +1283,14 @@ try_partial_hashjoin_path(PlannerInfo *root,
12861283
JoinCostWorkspace workspace;
12871284

12881285
/*
1289-
* If the inner path is parameterized, the parameterization must be fully
1290-
* satisfied by the proposed outer path. Parameterized partial paths are
1291-
* not supported. The caller should already have verified that no lateral
1292-
* rels are required here.
1286+
* If the inner path is parameterized, we can't use a partial hashjoin.
1287+
* Parameterized partial paths are not supported. The caller should
1288+
* already have verified that no lateral rels are required here.
12931289
*/
12941290
Assert(bms_is_empty(joinrel->lateral_relids));
1295-
if (inner_path->param_info != NULL)
1296-
{
1297-
Relids inner_paramrels = inner_path->param_info->ppi_req_outer;
1298-
1299-
if (!bms_is_empty(inner_paramrels))
1300-
return;
1301-
}
1291+
Assert(bms_is_empty(PATH_REQ_OUTER(outer_path)));
1292+
if (!bms_is_empty(PATH_REQ_OUTER(inner_path)))
1293+
return;
13021294

13031295
/*
13041296
* Before creating a path, get a quick lower bound on what it is likely to

0 commit comments

Comments
 (0)