88 *
99 *
1010 * IDENTIFICATION
11- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.38.2.1 2004/09/17 18:29:54 tgl Exp $
11+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.38.2.2 2004/10/13 21:56:22 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
2323#include "utils/memutils.h"
2424
2525
26- static TupleTableSlot * ExecHashJoinOuterGetTuple (Plan * node ,Plan * parent ,
26+ static TupleTableSlot * ExecHashJoinOuterGetTuple (Plan * node ,HashJoin * parent ,
2727HashJoinState * hjstate );
2828static TupleTableSlot * ExecHashJoinGetSavedTuple (HashJoinState * hjstate ,
2929BufFile * file ,
3030TupleTableSlot * tupleSlot );
3131static int ExecHashJoinGetBatch (int bucketno ,HashJoinTable hashtable );
32- static int ExecHashJoinNewBatch (HashJoinState * hjstate );
32+ static int ExecHashJoinNewBatch (HashJoinState * hjstate , HashJoin * node );
3333
3434
3535/* ----------------------------------------------------------------
@@ -155,7 +155,7 @@ ExecHashJoin(HashJoin *node)
155155if (hjstate -> hj_NeedNewOuter )
156156{
157157outerTupleSlot = ExecHashJoinOuterGetTuple (outerNode ,
158- ( Plan * ) node ,
158+ node ,
159159hjstate );
160160if (TupIsNull (outerTupleSlot ))
161161{
@@ -475,23 +475,23 @@ ExecEndHashJoin(HashJoin *node)
475475 */
476476
477477static TupleTableSlot *
478- ExecHashJoinOuterGetTuple (Plan * node ,Plan * parent ,HashJoinState * hjstate )
478+ ExecHashJoinOuterGetTuple (Plan * node ,HashJoin * parent ,HashJoinState * hjstate )
479479{
480480HashJoinTable hashtable = hjstate -> hj_HashTable ;
481481int curbatch = hashtable -> curbatch ;
482482TupleTableSlot * slot ;
483483
484484if (curbatch == 0 )
485485{/* if it is the first pass */
486- slot = ExecProcNode (node ,parent );
486+ slot = ExecProcNode (node ,( Plan * ) parent );
487487if (!TupIsNull (slot ))
488488return slot ;
489489
490490/*
491491 * We have just reached the end of the first pass. Try to switch
492492 * to a saved batch.
493493 */
494- curbatch = ExecHashJoinNewBatch (hjstate );
494+ curbatch = ExecHashJoinNewBatch (hjstate , parent );
495495}
496496
497497/*
@@ -505,7 +505,7 @@ ExecHashJoinOuterGetTuple(Plan *node, Plan *parent, HashJoinState *hjstate)
505505hjstate -> hj_OuterTupleSlot );
506506if (!TupIsNull (slot ))
507507return slot ;
508- curbatch = ExecHashJoinNewBatch (hjstate );
508+ curbatch = ExecHashJoinNewBatch (hjstate , parent );
509509}
510510
511511/* Out of batches... */
@@ -551,7 +551,7 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
551551 * ----------------------------------------------------------------
552552 */
553553static int
554- ExecHashJoinNewBatch (HashJoinState * hjstate )
554+ ExecHashJoinNewBatch (HashJoinState * hjstate , HashJoin * node )
555555{
556556HashJoinTable hashtable = hjstate -> hj_HashTable ;
557557int nbatch = hashtable -> nbatch ;
@@ -582,7 +582,7 @@ ExecHashJoinNewBatch(HashJoinState *hjstate)
582582while (newbatch <=nbatch &&
583583 (outerBatchSize [newbatch - 1 ]== 0L ||
584584(innerBatchSize [newbatch - 1 ]== 0L &&
585- hjstate -> js .jointype != JOIN_LEFT )))
585+ node -> join .jointype != JOIN_LEFT )))
586586{
587587BufFileClose (hashtable -> innerBatchFile [newbatch - 1 ]);
588588hashtable -> innerBatchFile [newbatch - 1 ]= NULL ;