@ -1290,6 +1290,9 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
void
void
ExecReScanHashJoin ( HashJoinState * node )
ExecReScanHashJoin ( HashJoinState * node )
{
{
PlanState * outerPlan = outerPlanState ( node ) ;
PlanState * innerPlan = innerPlanState ( node ) ;
/*
/*
* In a multi - batch join , we currently have to do rescans the hard way ,
* In a multi - batch join , we currently have to do rescans the hard way ,
* primarily because batch temp files may have already been released . But
* primarily because batch temp files may have already been released . But
@ -1300,7 +1303,7 @@ ExecReScanHashJoin(HashJoinState *node)
if ( node - > hj_HashTable ! = NULL )
if ( node - > hj_HashTable ! = NULL )
{
{
if ( node - > hj_HashTable - > nbatch = = 1 & &
if ( node - > hj_HashTable - > nbatch = = 1 & &
node - > js . ps . righttree - > chgParam = = NULL )
innerPlan - > chgParam = = NULL )
{
{
/*
/*
* Okay to reuse the hash table ; needn ' t rescan inner , either .
* Okay to reuse the hash table ; needn ' t rescan inner , either .
@ -1328,7 +1331,7 @@ ExecReScanHashJoin(HashJoinState *node)
else
else
{
{
/* must destroy and rebuild hash table */
/* must destroy and rebuild hash table */
HashState * hashNode = castNode ( HashState , innerPlanState ( node ) ) ;
HashState * hashNode = castNode ( HashState , innerPlan ) ;
Assert ( hashNode - > hashtable = = node - > hj_HashTable ) ;
Assert ( hashNode - > hashtable = = node - > hj_HashTable ) ;
/* accumulate stats from old hash table, if wanted */
/* accumulate stats from old hash table, if wanted */
@ -1350,8 +1353,8 @@ ExecReScanHashJoin(HashJoinState *node)
* if chgParam of subnode is not null then plan will be re - scanned
* if chgParam of subnode is not null then plan will be re - scanned
* by first ExecProcNode .
* by first ExecProcNode .
*/
*/
if ( node - > js . ps . righttree - > chgParam = = NULL )
if ( innerPlan - > chgParam = = NULL )
ExecReScan ( node - > js . ps . righttree ) ;
ExecReScan ( innerPlan ) ;
}
}
}
}
@ -1368,8 +1371,8 @@ ExecReScanHashJoin(HashJoinState *node)
* if chgParam of subnode is not null then plan will be re - scanned by
* if chgParam of subnode is not null then plan will be re - scanned by
* first ExecProcNode .
* first ExecProcNode .
*/
*/
if ( node - > js . ps . lefttree - > chgParam = = NULL )
if ( outerPlan - > chgParam = = NULL )
ExecReScan ( node - > js . ps . lefttree ) ;
ExecReScan ( outerPlan ) ;
}
}
void
void