8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.39.2.1 2004/09/17 18:29:40 tgl Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.39.2.2 2004/10/13 21:56:14 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
23
23
#include "utils/memutils.h"
24
24
25
25
26
- static TupleTableSlot * ExecHashJoinOuterGetTuple (Plan * node ,Plan * parent ,
26
+ static TupleTableSlot * ExecHashJoinOuterGetTuple (Plan * node ,HashJoin * parent ,
27
27
HashJoinState * hjstate );
28
28
static TupleTableSlot * ExecHashJoinGetSavedTuple (HashJoinState * hjstate ,
29
29
BufFile * file ,
30
30
TupleTableSlot * tupleSlot );
31
31
static int ExecHashJoinGetBatch (int bucketno ,HashJoinTable hashtable );
32
- static int ExecHashJoinNewBatch (HashJoinState * hjstate );
32
+ static int ExecHashJoinNewBatch (HashJoinState * hjstate , HashJoin * node );
33
33
34
34
35
35
/* ----------------------------------------------------------------
@@ -154,7 +154,7 @@ ExecHashJoin(HashJoin *node)
154
154
if (hjstate -> hj_NeedNewOuter )
155
155
{
156
156
outerTupleSlot = ExecHashJoinOuterGetTuple (outerNode ,
157
- ( Plan * ) node ,
157
+ node ,
158
158
hjstate );
159
159
if (TupIsNull (outerTupleSlot ))
160
160
{
@@ -470,23 +470,23 @@ ExecEndHashJoin(HashJoin *node)
470
470
*/
471
471
472
472
static TupleTableSlot *
473
- ExecHashJoinOuterGetTuple (Plan * node ,Plan * parent ,HashJoinState * hjstate )
473
+ ExecHashJoinOuterGetTuple (Plan * node ,HashJoin * parent ,HashJoinState * hjstate )
474
474
{
475
475
HashJoinTable hashtable = hjstate -> hj_HashTable ;
476
476
int curbatch = hashtable -> curbatch ;
477
477
TupleTableSlot * slot ;
478
478
479
479
if (curbatch == 0 )
480
480
{/* if it is the first pass */
481
- slot = ExecProcNode (node ,parent );
481
+ slot = ExecProcNode (node ,( Plan * ) parent );
482
482
if (!TupIsNull (slot ))
483
483
return slot ;
484
484
485
485
/*
486
486
* We have just reached the end of the first pass. Try to switch
487
487
* to a saved batch.
488
488
*/
489
- curbatch = ExecHashJoinNewBatch (hjstate );
489
+ curbatch = ExecHashJoinNewBatch (hjstate , parent );
490
490
}
491
491
492
492
/*
@@ -500,7 +500,7 @@ ExecHashJoinOuterGetTuple(Plan *node, Plan *parent, HashJoinState *hjstate)
500
500
hjstate -> hj_OuterTupleSlot );
501
501
if (!TupIsNull (slot ))
502
502
return slot ;
503
- curbatch = ExecHashJoinNewBatch (hjstate );
503
+ curbatch = ExecHashJoinNewBatch (hjstate , parent );
504
504
}
505
505
506
506
/* Out of batches... */
@@ -546,7 +546,7 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
546
546
* ----------------------------------------------------------------
547
547
*/
548
548
static int
549
- ExecHashJoinNewBatch (HashJoinState * hjstate )
549
+ ExecHashJoinNewBatch (HashJoinState * hjstate , HashJoin * node )
550
550
{
551
551
HashJoinTable hashtable = hjstate -> hj_HashTable ;
552
552
int nbatch = hashtable -> nbatch ;
@@ -576,7 +576,7 @@ ExecHashJoinNewBatch(HashJoinState *hjstate)
576
576
while (newbatch <=nbatch &&
577
577
(outerBatchSize [newbatch - 1 ]== 0L ||
578
578
(innerBatchSize [newbatch - 1 ]== 0L &&
579
- hjstate -> js .jointype != JOIN_LEFT )))
579
+ node -> join .jointype != JOIN_LEFT )))
580
580
{
581
581
BufFileClose (hashtable -> innerBatchFile [newbatch - 1 ]);
582
582
hashtable -> innerBatchFile [newbatch - 1 ]= NULL ;