Move hasSemiJoin to JoinRestrictionContext (#4256)

pull/4250/head
Onur Tirtir 2020-10-16 18:37:39 +03:00 committed by GitHub
parent 3261fc7eef
commit 7cb07c70fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 4 deletions

View File

@ -1742,7 +1742,7 @@ multi_join_restriction_hook(PlannerInfo *root,
* later safely convert any semi joins in the rewritten query to inner
* joins.
*/
plannerRestrictionContext->hasSemiJoin = plannerRestrictionContext->hasSemiJoin ||
joinRestrictionContext->hasSemiJoin = joinRestrictionContext->hasSemiJoin ||
extra->sjinfo->jointype == JOIN_SEMI;
MemoryContextSwitchTo(oldMemoryContext);

View File

@ -138,7 +138,9 @@ ShouldUseSubqueryPushDown(Query *originalQuery, Query *rewrittenQuery,
* joins of type JOIN_SEMI are sent it is safe to convert all JOIN_SEMI
* nodes to JOIN_INNER nodes (which is what is done in MultiNodeTree).
*/
if (plannerRestrictionContext->hasSemiJoin)
JoinRestrictionContext *joinRestrictionContext =
plannerRestrictionContext->joinRestrictionContext;
if (joinRestrictionContext->hasSemiJoin)
{
return true;
}

View File

@ -1897,6 +1897,9 @@ FilterJoinRestrictionContext(JoinRestrictionContext *joinRestrictionContext, Rel
}
}
/* the filtered restriction might not have semiJoin, but it is OK for now */
filtererdJoinRestrictionContext->hasSemiJoin = joinRestrictionContext->hasSemiJoin;
return filtererdJoinRestrictionContext;
}
@ -2016,6 +2019,9 @@ RemoveDuplicateJoinRestrictions(JoinRestrictionContext *joinRestrictionContext)
lappend(filteredContext->joinRestrictionList, joinRestriction);
}
/* the filtered restriction might not have semiJoin, but it is OK for now */
filteredContext->hasSemiJoin = joinRestrictionContext->hasSemiJoin;
return filteredContext;
}

View File

@ -75,6 +75,7 @@ typedef struct RelationRestriction
typedef struct JoinRestrictionContext
{
List *joinRestrictionList;
bool hasSemiJoin;
} JoinRestrictionContext;
typedef struct JoinRestriction
@ -116,7 +117,6 @@ typedef struct PlannerRestrictionContext
* Instead, we keep this struct to pass some extra information.
*/
FastPathRestrictionContext *fastPathRestrictionContext;
bool hasSemiJoin;
MemoryContext memoryContext;
} PlannerRestrictionContext;