Running citus_indent to resolve indentation issues

pull/7810/head
Muhammad Usama 2024-12-26 00:51:38 +05:00 committed by Muhammad Usama
parent 2943e7f18d
commit 5d148b75c3
1 changed files with 24 additions and 11 deletions

View File

@ -179,7 +179,7 @@ static bool HasConstantFilterOnUniqueColumn(RangeTblEntry *rangeTableEntry,
RelationRestriction *relationRestriction); RelationRestriction *relationRestriction);
static bool HasDependencyOnInitPlanParam(RangeTblEntry *rangeTableEntry, static bool HasDependencyOnInitPlanParam(RangeTblEntry *rangeTableEntry,
RelationRestriction *relationRestriction); RelationRestriction *relationRestriction);
static ConversionCandidates * CreateConversionCandidates(PlannerRestrictionContext * static ConversionCandidates * CreateConversionCandidates(PlannerRestrictionContext *
plannerRestrictionContext, plannerRestrictionContext,
@ -300,8 +300,9 @@ GetConversionChoice(ConversionCandidates *conversionCandidates,
* If Local table is referenced by the InitPlan that is kind of a One time filter, * If Local table is referenced by the InitPlan that is kind of a One time filter,
* In that case we should refrain from converting the local tables. * In that case we should refrain from converting the local tables.
*/ */
return localRTECandidate && (!localRTECandidate->hasDependencyOnInitPlanParam) ? return localRTECandidate &&
CONVERT_LOCAL_TABLES : CONVERT_DISTRIBUTED_TABLES; (!localRTECandidate->hasDependencyOnInitPlanParam) ?
CONVERT_LOCAL_TABLES : CONVERT_DISTRIBUTED_TABLES;
} }
else if (LocalTableJoinPolicy == LOCAL_JOIN_POLICY_PREFER_DISTRIBUTED) else if (LocalTableJoinPolicy == LOCAL_JOIN_POLICY_PREFER_DISTRIBUTED)
{ {
@ -325,8 +326,9 @@ GetConversionChoice(ConversionCandidates *conversionCandidates,
} }
else else
{ {
return localRTECandidate && (!localRTECandidate->hasDependencyOnInitPlanParam) ? return localRTECandidate &&
CONVERT_LOCAL_TABLES : CONVERT_DISTRIBUTED_TABLES; (!localRTECandidate->hasDependencyOnInitPlanParam) ?
CONVERT_LOCAL_TABLES : CONVERT_DISTRIBUTED_TABLES;
} }
} }
} }
@ -403,10 +405,9 @@ ShouldConvertLocalTableJoinsToSubqueries(List *rangeTableList)
*/ */
static bool static bool
HasDependencyOnInitPlanParam(RangeTblEntry *rangeTableEntry, HasDependencyOnInitPlanParam(RangeTblEntry *rangeTableEntry,
RelationRestriction *relationRestriction) RelationRestriction *relationRestriction)
{ {
List* whereClauseList; List *initPlanParamIDs = NIL;
List* initPlanParamIDs = NIL;
ListCell *lc = NULL; ListCell *lc = NULL;
/* /*
@ -414,11 +415,17 @@ HasDependencyOnInitPlanParam(RangeTblEntry *rangeTableEntry,
* does not contain joininfo. * does not contain joininfo.
*/ */
if (rangeTableEntry == NULL || relationRestriction == NULL) if (rangeTableEntry == NULL || relationRestriction == NULL)
{
return false; return false;
}
if (relationRestriction->relOptInfo->joininfo == NULL) if (relationRestriction->relOptInfo->joininfo == NULL)
{
return false; return false;
}
if (relationRestriction->plannerInfo->init_plans == NULL) if (relationRestriction->plannerInfo->init_plans == NULL)
{
return false; return false;
}
/* /*
* Gather all parameter IDs referenced by the InitPlan * Gather all parameter IDs referenced by the InitPlan
@ -432,19 +439,24 @@ HasDependencyOnInitPlanParam(RangeTblEntry *rangeTableEntry,
SubPlan *subplan = (SubPlan *) plan; SubPlan *subplan = (SubPlan *) plan;
if (subplan->setParam != NIL) if (subplan->setParam != NIL)
{ {
initPlanParamIDs = list_concat_unique_int(initPlanParamIDs, subplan->setParam); initPlanParamIDs = list_concat_unique_int(initPlanParamIDs,
subplan->setParam);
} }
} }
} }
if (initPlanParamIDs == NIL) if (initPlanParamIDs == NIL)
{
return false; return false;
}
/* /*
* Check if any parameter in the join conditions (join info) for this relation * Check if any parameter in the join conditions (join info) for this relation
* is referenced by the initPlan. This is important to ensure that we can * is referenced by the initPlan. This is important to ensure that we can
* decide whether we want to convert local or remote tables. * decide whether we want to convert local or remote tables.
*/ */
whereClauseList = extract_actual_clauses(relationRestriction->relOptInfo->joininfo, true); List *whereClauseList = extract_actual_clauses(
relationRestriction->relOptInfo->joininfo,
true);
foreach(lc, whereClauseList) foreach(lc, whereClauseList)
{ {
@ -465,6 +477,7 @@ HasDependencyOnInitPlanParam(RangeTblEntry *rangeTableEntry,
return false; return false;
} }
/* /*
* HasConstantFilterOnUniqueColumn returns true if the given rangeTableEntry has a constant * HasConstantFilterOnUniqueColumn returns true if the given rangeTableEntry has a constant
* filter on a unique column. * filter on a unique column.