Skip to content

Commit f3f7c2a

Browse files
committed
update comments
1 parent 02fa3e4 commit f3f7c2a

File tree

1 file changed

+89
-78
lines changed

1 file changed

+89
-78
lines changed

src/backend/executor/nodeMergejoin.c

Lines changed: 89 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.23 1999/02/23 07:35:09 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.24 1999/02/24 10:20:07 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -288,7 +288,7 @@ MergeCompare(List *eqQual, List *compareQual, ExprContext *econtext)
288288
*/
289289
#ifdef EXEC_MERGEJOINDEBUG
290290
void
291-
ExecMergeTupleDumpInner(ExprContext *econtext);
291+
ExecMergeTupleDumpInner(ExprContext *econtext);
292292

293293
void
294294
ExecMergeTupleDumpInner(ExprContext *econtext)
@@ -305,7 +305,7 @@ ExecMergeTupleDumpInner(ExprContext *econtext)
305305
}
306306

307307
void
308-
ExecMergeTupleDumpOuter(ExprContext *econtext);
308+
ExecMergeTupleDumpOuter(ExprContext *econtext);
309309

310310
void
311311
ExecMergeTupleDumpOuter(ExprContext *econtext)
@@ -321,8 +321,7 @@ ExecMergeTupleDumpOuter(ExprContext *econtext)
321321
outerSlot->ttc_tupleDescriptor);
322322
}
323323

324-
void
325-
ExecMergeTupleDumpMarked(ExprContext *econtext,
324+
void ExecMergeTupleDumpMarked(ExprContext *econtext,
326325
MergeJoinState *mergestate);
327326

328327
void
@@ -342,7 +341,7 @@ ExecMergeTupleDumpMarked(ExprContext *econtext,
342341
}
343342

344343
void
345-
ExecMergeTupleDump(ExprContext *econtext, MergeJoinState *mergestate);
344+
ExecMergeTupleDump(ExprContext *econtext, MergeJoinState *mergestate);
346345

347346
void
348347
ExecMergeTupleDump(ExprContext *econtext, MergeJoinState *mergestate)
@@ -355,6 +354,7 @@ ExecMergeTupleDump(ExprContext *econtext, MergeJoinState *mergestate)
355354

356355
printf("******** \n");
357356
}
357+
358358
#endif
359359

360360
/* ----------------------------------------------------------------
@@ -427,11 +427,14 @@ ExecMergeJoin(MergeJoin *node)
427427
ExprContext *econtext;
428428

429429
#ifdef ENABLE_OUTER_JOINS
430-
/* These should be set from the expression context!
431-
* - thomas 1999-02-20
430+
431+
/*
432+
* These should be set from the expression context! - thomas
433+
* 1999-02-20
432434
*/
433435
static bool isLeftJoin = true;
434436
static bool isRightJoin = false;
437+
435438
#endif
436439

437440
/* ----------------
@@ -486,19 +489,19 @@ ExecMergeJoin(MergeJoin *node)
486489
switch (mergestate->mj_JoinState)
487490
{
488491

489-
/*********************************
492+
/*
490493
* EXEC_MJ_INITIALIZE means that this is the first time
491-
* ExecMergeJoin() has been called and so we have to initialize
492-
* the inner, outer and marked tuples as well as various stuff
493-
* in the expression context.
494-
*********************************/
494+
* ExecMergeJoin() has been called and so we have to
495+
* initialize the inner, outer and marked tuples as well
496+
* as various stuff in the expression context.
497+
*/
495498
case EXEC_MJ_INITIALIZE:
496499
MJ_printf("ExecMergeJoin: EXEC_MJ_INITIALIZE\n");
497-
/* ----------------
498-
* Note: at this point, if either of our inner or outer
499-
* tuples are nil, then the join ends immediately because
500-
* we know one of the subplans is empty.
501-
* ----------------
500+
501+
/*
502+
* Note: at this point, if either of our inner or outer
503+
* tuples are nil, then the join ends immediately because
504+
* we know one of the subplans is empty.
502505
*/
503506
innerTupleSlot = ExecProcNode(innerPlan, (Plan *) node);
504507
if (TupIsNull(innerTupleSlot))
@@ -531,11 +534,12 @@ ExecMergeJoin(MergeJoin *node)
531534
mergestate->mj_JoinState = EXEC_MJ_SKIPINNER;
532535
break;
533536

534-
/*********************************
535-
* EXEC_MJ_JOINMARK means we have just found a new outer tuple
536-
* and a possible matching inner tuple. This is the case after
537-
* the INITIALIZE, SKIPOUTER or SKIPINNER states.
538-
*********************************/
537+
/*
538+
* EXEC_MJ_JOINMARK means we have just found a new outer
539+
* tuple and a possible matching inner tuple. This is the
540+
* case after the INITIALIZE, SKIPOUTER or SKIPINNER
541+
* states.
542+
*/
539543
case EXEC_MJ_JOINMARK:
540544
MJ_printf("ExecMergeJoin: EXEC_MJ_JOINMARK\n");
541545
ExecMarkPos(innerPlan);
@@ -545,15 +549,15 @@ ExecMergeJoin(MergeJoin *node)
545549
mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
546550
break;
547551

548-
/*********************************
552+
/*
549553
* EXEC_MJ_JOINTEST means we have two tuples which might
550554
* satisfy the merge clause, so we test them.
551555
*
552556
* If they do satisfy, then we join them and move on to the
553557
* next inner tuple (EXEC_MJ_JOINTUPLES).
554558
*
555559
* If they do not satisfy then advance to next outer tuple.
556-
*********************************/
560+
*/
557561
case EXEC_MJ_JOINTEST:
558562
MJ_printf("ExecMergeJoin: EXEC_MJ_JOINTEST\n");
559563

@@ -566,11 +570,11 @@ ExecMergeJoin(MergeJoin *node)
566570
mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
567571
break;
568572

569-
/*********************************
573+
/*
570574
* EXEC_MJ_JOINTUPLES means we have two tuples which
571575
* satisified the merge clause so we join them and then
572576
* proceed to get the next inner tuple (EXEC_NEXT_INNER).
573-
*********************************/
577+
*/
574578
case EXEC_MJ_JOINTUPLES:
575579
MJ_printf("ExecMergeJoin: EXEC_MJ_JOINTUPLES\n");
576580
mergestate->mj_JoinState = EXEC_MJ_NEXTINNER;
@@ -599,11 +603,11 @@ ExecMergeJoin(MergeJoin *node)
599603
}
600604
break;
601605

602-
/*********************************
603-
* EXEC_MJ_NEXTINNER means advance the inner scan to
604-
* the next tuple. If the tuple is not nil, we then
605-
* proceed to test it against the join qualification.
606-
*********************************/
606+
/*
607+
* EXEC_MJ_NEXTINNER means advance the inner scan to the
608+
* next tuple. If the tuple is not nil, we then proceed to
609+
* test it against the join qualification.
610+
*/
607611
case EXEC_MJ_NEXTINNER:
608612
MJ_printf("ExecMergeJoin: EXEC_MJ_NEXTINNER\n");
609613

@@ -621,21 +625,22 @@ ExecMergeJoin(MergeJoin *node)
621625
mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
622626
break;
623627

624-
/*********************************
628+
/*-------------------------------------------
625629
* EXEC_MJ_NEXTOUTER means
626630
*
627-
* outer inner
628-
* outer tuple - 5 5 - marked tuple
629-
* 5 5
630-
* 6 6 - inner tuple
631-
* 7 7
631+
* outer inner
632+
* outer tuple - 5 5 - marked tuple
633+
* 5 5
634+
* 6 6 - inner tuple
635+
* 7 7
632636
*
633-
* we know we just bumped into the
637+
* we know we just bumped into the
634638
* first inner tuple > current outer tuple
635639
* so get a new outer tuple and then
636640
* proceed to test it against the marked tuple
637641
* (EXEC_MJ_TESTOUTER)
638-
*********************************/
642+
*------------------------------------------------
643+
*/
639644
case EXEC_MJ_NEXTOUTER:
640645
MJ_printf("ExecMergeJoin: EXEC_MJ_NEXTOUTER\n");
641646

@@ -657,7 +662,7 @@ ExecMergeJoin(MergeJoin *node)
657662
mergestate->mj_JoinState = EXEC_MJ_TESTOUTER;
658663
break;
659664

660-
/*********************************
665+
/*--------------------------------------------------------
661666
* EXEC_MJ_TESTOUTER If the new outer tuple and the marked
662667
* tuple satisfy the merge clause then we know we have
663668
* duplicates in the outer scan so we have to restore the
@@ -687,9 +692,10 @@ ExecMergeJoin(MergeJoin *node)
687692
* 7 12
688693
*
689694
*
690-
* new outer tuple > marked tuple
695+
* new outer tuple > marked tuple
691696
*
692-
*********************************/
697+
*---------------------------------------------------------
698+
*/
693699
case EXEC_MJ_TESTOUTER:
694700
MJ_printf("ExecMergeJoin: EXEC_MJ_TESTOUTER\n");
695701

@@ -731,11 +737,11 @@ ExecMergeJoin(MergeJoin *node)
731737
* tuple didn't match the marked outer tuple then
732738
* we may have the case:
733739
*
734-
* outer inner
735-
* 4 4 - marked tuple
736-
* new outer - 5 4
737-
* 6 nil - inner tuple
738-
* 7
740+
* outer inner
741+
* 4 4 - marked tuple
742+
* new outer - 5 4
743+
* 6 nil - inner tuple
744+
* 7
739745
*
740746
* which means that all subsequent outer tuples will be
741747
* larger than our inner tuples.
@@ -760,22 +766,23 @@ ExecMergeJoin(MergeJoin *node)
760766
}
761767
break;
762768

763-
/*********************************
769+
/*----------------------------------------------------------
764770
* EXEC_MJ_SKIPOUTER means skip over tuples in the outer plan
765771
* until we find an outer tuple > current inner tuple.
766772
*
767773
* For example:
768774
*
769-
* outer inner
770-
* 5 5
771-
* 5 5
772-
* outer tuple - 6 8 - inner tuple
773-
* 7 12
774-
* 8 14
775+
* outer inner
776+
* 5 5
777+
* 5 5
778+
* outer tuple - 6 8 - inner tuple
779+
* 7 12
780+
* 8 14
775781
*
776782
* we have to advance the outer scan
777783
* until we find the outer 8.
778-
*********************************/
784+
*----------------------------------------------------------
785+
*/
779786
case EXEC_MJ_SKIPOUTER:
780787
MJ_printf("ExecMergeJoin: EXEC_MJ_SKIPOUTER\n");
781788
/* ----------------
@@ -867,23 +874,24 @@ ExecMergeJoin(MergeJoin *node)
867874
mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
868875
break;
869876

870-
/*********************************
877+
/*-----------------------------------------------------------
871878
* EXEC_MJ_SKIPINNER means skip over tuples in the inner plan
872879
* until we find an inner tuple > current outer tuple.
873880
*
874881
* For example:
875882
*
876-
* outer inner
877-
* 5 5
878-
* 5 5
879-
* outer tuple - 12 8 - inner tuple
880-
* 14 10
881-
* 17 12
883+
* outer inner
884+
* 5 5
885+
* 5 5
886+
* outer tuple - 12 8 - inner tuple
887+
* 14 10
888+
* 17 12
882889
*
883890
* we have to advance the inner scan
884891
* until we find the inner 12.
885892
*
886-
*********************************/
893+
*-------------------------------------------------------
894+
*/
887895
case EXEC_MJ_SKIPINNER:
888896
MJ_printf("ExecMergeJoin: EXEC_MJ_SKIPINNER\n");
889897
/* ----------------
@@ -997,11 +1005,13 @@ ExecMergeJoin(MergeJoin *node)
9971005
break;
9981006

9991007
#ifdef ENABLE_OUTER_JOINS
1000-
/*********************************
1001-
* EXEC_MJ_FILLINNER means we have an unmatched inner tuple
1002-
* which must be null-expanded into the projection tuple.
1003-
* get the next inner tuple and reset markers (EXEC_MJ_JOINMARK).
1004-
*********************************/
1008+
1009+
/*
1010+
* EXEC_MJ_FILLINNER means we have an unmatched inner
1011+
* tuple which must be null-expanded into the projection
1012+
* tuple. get the next inner tuple and reset markers
1013+
* (EXEC_MJ_JOINMARK).
1014+
*/
10051015
case EXEC_MJ_FILLINNER:
10061016
MJ_printf("ExecMergeJoin: EXEC_MJ_FILLINNER\n");
10071017
mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
@@ -1046,11 +1056,12 @@ ExecMergeJoin(MergeJoin *node)
10461056
*/
10471057
break;
10481058

1049-
/*********************************
1050-
* EXEC_MJ_FILLOUTER means we have an unmatched outer tuple
1051-
* which must be null-expanded into the projection tuple.
1052-
* get the next outer tuple and reset markers (EXEC_MJ_JOINMARK).
1053-
*********************************/
1059+
/*
1060+
* EXEC_MJ_FILLOUTER means we have an unmatched outer
1061+
* tuple which must be null-expanded into the projection
1062+
* tuple. get the next outer tuple and reset markers
1063+
* (EXEC_MJ_JOINMARK).
1064+
*/
10541065
case EXEC_MJ_FILLOUTER:
10551066
MJ_printf("ExecMergeJoin: EXEC_MJ_FILLOUTER\n");
10561067
mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
@@ -1095,10 +1106,10 @@ ExecMergeJoin(MergeJoin *node)
10951106
break;
10961107
#endif
10971108

1098-
/*********************************
1099-
* if we get here it means our code is fouled up
1100-
* and so we just end the join prematurely.
1101-
*********************************/
1109+
/*
1110+
* if we get here it means our code is fouled up and so we
1111+
* just end the join prematurely.
1112+
*/
11021113
default:
11031114
elog(NOTICE, "ExecMergeJoin: invalid join state. aborting");
11041115
return NULL;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy