Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
f3f7c2ac
Commit
f3f7c2ac
authored
Feb 24, 1999
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update comments
parent
02fa3e43
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
78 deletions
+89
-78
src/backend/executor/nodeMergejoin.c
src/backend/executor/nodeMergejoin.c
+89
-78
No files found.
src/backend/executor/nodeMergejoin.c
View file @
f3f7c2ac
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.2
3 1999/02/23 07:35:09 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.2
4 1999/02/24 10:20:07 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -288,7 +288,7 @@ MergeCompare(List *eqQual, List *compareQual, ExprContext *econtext)
...
@@ -288,7 +288,7 @@ MergeCompare(List *eqQual, List *compareQual, ExprContext *econtext)
*/
*/
#ifdef EXEC_MERGEJOINDEBUG
#ifdef EXEC_MERGEJOINDEBUG
void
void
ExecMergeTupleDumpInner
(
ExprContext
*
econtext
);
ExecMergeTupleDumpInner
(
ExprContext
*
econtext
);
void
void
ExecMergeTupleDumpInner
(
ExprContext
*
econtext
)
ExecMergeTupleDumpInner
(
ExprContext
*
econtext
)
...
@@ -305,7 +305,7 @@ ExecMergeTupleDumpInner(ExprContext *econtext)
...
@@ -305,7 +305,7 @@ ExecMergeTupleDumpInner(ExprContext *econtext)
}
}
void
void
ExecMergeTupleDumpOuter
(
ExprContext
*
econtext
);
ExecMergeTupleDumpOuter
(
ExprContext
*
econtext
);
void
void
ExecMergeTupleDumpOuter
(
ExprContext
*
econtext
)
ExecMergeTupleDumpOuter
(
ExprContext
*
econtext
)
...
@@ -321,8 +321,7 @@ ExecMergeTupleDumpOuter(ExprContext *econtext)
...
@@ -321,8 +321,7 @@ ExecMergeTupleDumpOuter(ExprContext *econtext)
outerSlot
->
ttc_tupleDescriptor
);
outerSlot
->
ttc_tupleDescriptor
);
}
}
void
void
ExecMergeTupleDumpMarked
(
ExprContext
*
econtext
,
ExecMergeTupleDumpMarked
(
ExprContext
*
econtext
,
MergeJoinState
*
mergestate
);
MergeJoinState
*
mergestate
);
void
void
...
@@ -342,7 +341,7 @@ ExecMergeTupleDumpMarked(ExprContext *econtext,
...
@@ -342,7 +341,7 @@ ExecMergeTupleDumpMarked(ExprContext *econtext,
}
}
void
void
ExecMergeTupleDump
(
ExprContext
*
econtext
,
MergeJoinState
*
mergestate
);
ExecMergeTupleDump
(
ExprContext
*
econtext
,
MergeJoinState
*
mergestate
);
void
void
ExecMergeTupleDump
(
ExprContext
*
econtext
,
MergeJoinState
*
mergestate
)
ExecMergeTupleDump
(
ExprContext
*
econtext
,
MergeJoinState
*
mergestate
)
...
@@ -355,6 +354,7 @@ ExecMergeTupleDump(ExprContext *econtext, MergeJoinState *mergestate)
...
@@ -355,6 +354,7 @@ ExecMergeTupleDump(ExprContext *econtext, MergeJoinState *mergestate)
printf
(
"********
\n
"
);
printf
(
"********
\n
"
);
}
}
#endif
#endif
/* ----------------------------------------------------------------
/* ----------------------------------------------------------------
...
@@ -427,11 +427,14 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -427,11 +427,14 @@ ExecMergeJoin(MergeJoin *node)
ExprContext
*
econtext
;
ExprContext
*
econtext
;
#ifdef ENABLE_OUTER_JOINS
#ifdef ENABLE_OUTER_JOINS
/* These should be set from the expression context!
* - thomas 1999-02-20
/*
* These should be set from the expression context! - thomas
* 1999-02-20
*/
*/
static
bool
isLeftJoin
=
true
;
static
bool
isLeftJoin
=
true
;
static
bool
isRightJoin
=
false
;
static
bool
isRightJoin
=
false
;
#endif
#endif
/* ----------------
/* ----------------
...
@@ -486,19 +489,19 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -486,19 +489,19 @@ ExecMergeJoin(MergeJoin *node)
switch
(
mergestate
->
mj_JoinState
)
switch
(
mergestate
->
mj_JoinState
)
{
{
/*
********************************
/*
* EXEC_MJ_INITIALIZE means that this is the first time
* EXEC_MJ_INITIALIZE means that this is the first time
* ExecMergeJoin() has been called and so we have to
initialize
* ExecMergeJoin() has been called and so we have to
*
the inner, outer and marked tuples as well as various stuff
*
initialize the inner, outer and marked tuples as well
* in the expression context.
*
as various stuff
in the expression context.
*
********************************
/
*/
case
EXEC_MJ_INITIALIZE
:
case
EXEC_MJ_INITIALIZE
:
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_INITIALIZE
\n
"
);
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_INITIALIZE
\n
"
);
/* ----------------
/*
* Note: at this point, if either of our inner or outer
* Note: at this point, if either of our inner or outer
* tuples are nil, then the join ends immediately because
* tuples are nil, then the join ends immediately because
* we know one of the subplans is empty.
* we know one of the subplans is empty.
* ----------------
*/
*/
innerTupleSlot
=
ExecProcNode
(
innerPlan
,
(
Plan
*
)
node
);
innerTupleSlot
=
ExecProcNode
(
innerPlan
,
(
Plan
*
)
node
);
if
(
TupIsNull
(
innerTupleSlot
))
if
(
TupIsNull
(
innerTupleSlot
))
...
@@ -531,11 +534,12 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -531,11 +534,12 @@ ExecMergeJoin(MergeJoin *node)
mergestate
->
mj_JoinState
=
EXEC_MJ_SKIPINNER
;
mergestate
->
mj_JoinState
=
EXEC_MJ_SKIPINNER
;
break
;
break
;
/*********************************
/*
* EXEC_MJ_JOINMARK means we have just found a new outer tuple
* EXEC_MJ_JOINMARK means we have just found a new outer
* and a possible matching inner tuple. This is the case after
* tuple and a possible matching inner tuple. This is the
* the INITIALIZE, SKIPOUTER or SKIPINNER states.
* case after the INITIALIZE, SKIPOUTER or SKIPINNER
*********************************/
* states.
*/
case
EXEC_MJ_JOINMARK
:
case
EXEC_MJ_JOINMARK
:
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_JOINMARK
\n
"
);
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_JOINMARK
\n
"
);
ExecMarkPos
(
innerPlan
);
ExecMarkPos
(
innerPlan
);
...
@@ -545,7 +549,7 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -545,7 +549,7 @@ ExecMergeJoin(MergeJoin *node)
mergestate
->
mj_JoinState
=
EXEC_MJ_JOINTEST
;
mergestate
->
mj_JoinState
=
EXEC_MJ_JOINTEST
;
break
;
break
;
/*
********************************
/*
* EXEC_MJ_JOINTEST means we have two tuples which might
* EXEC_MJ_JOINTEST means we have two tuples which might
* satisfy the merge clause, so we test them.
* satisfy the merge clause, so we test them.
*
*
...
@@ -553,7 +557,7 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -553,7 +557,7 @@ ExecMergeJoin(MergeJoin *node)
* next inner tuple (EXEC_MJ_JOINTUPLES).
* next inner tuple (EXEC_MJ_JOINTUPLES).
*
*
* If they do not satisfy then advance to next outer tuple.
* If they do not satisfy then advance to next outer tuple.
*
********************************
/
*/
case
EXEC_MJ_JOINTEST
:
case
EXEC_MJ_JOINTEST
:
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_JOINTEST
\n
"
);
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_JOINTEST
\n
"
);
...
@@ -566,11 +570,11 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -566,11 +570,11 @@ ExecMergeJoin(MergeJoin *node)
mergestate
->
mj_JoinState
=
EXEC_MJ_NEXTOUTER
;
mergestate
->
mj_JoinState
=
EXEC_MJ_NEXTOUTER
;
break
;
break
;
/*
********************************
/*
* EXEC_MJ_JOINTUPLES means we have two tuples which
* EXEC_MJ_JOINTUPLES means we have two tuples which
* satisified the merge clause so we join them and then
* satisified the merge clause so we join them and then
* proceed to get the next inner tuple (EXEC_NEXT_INNER).
* proceed to get the next inner tuple (EXEC_NEXT_INNER).
*
********************************
/
*/
case
EXEC_MJ_JOINTUPLES
:
case
EXEC_MJ_JOINTUPLES
:
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_JOINTUPLES
\n
"
);
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_JOINTUPLES
\n
"
);
mergestate
->
mj_JoinState
=
EXEC_MJ_NEXTINNER
;
mergestate
->
mj_JoinState
=
EXEC_MJ_NEXTINNER
;
...
@@ -599,11 +603,11 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -599,11 +603,11 @@ ExecMergeJoin(MergeJoin *node)
}
}
break
;
break
;
/*
********************************
/*
* EXEC_MJ_NEXTINNER means advance the inner scan to
* EXEC_MJ_NEXTINNER means advance the inner scan to
the
*
the next tuple. If the tuple is not nil, we then
*
next tuple. If the tuple is not nil, we then proceed to
*
proceed to
test it against the join qualification.
* test it against the join qualification.
*
********************************
/
*/
case
EXEC_MJ_NEXTINNER
:
case
EXEC_MJ_NEXTINNER
:
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_NEXTINNER
\n
"
);
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_NEXTINNER
\n
"
);
...
@@ -621,7 +625,7 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -621,7 +625,7 @@ ExecMergeJoin(MergeJoin *node)
mergestate
->
mj_JoinState
=
EXEC_MJ_JOINTEST
;
mergestate
->
mj_JoinState
=
EXEC_MJ_JOINTEST
;
break
;
break
;
/*
********************************
/*
-------------------------------------------
* EXEC_MJ_NEXTOUTER means
* EXEC_MJ_NEXTOUTER means
*
*
* outer inner
* outer inner
...
@@ -635,7 +639,8 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -635,7 +639,8 @@ ExecMergeJoin(MergeJoin *node)
* so get a new outer tuple and then
* so get a new outer tuple and then
* proceed to test it against the marked tuple
* proceed to test it against the marked tuple
* (EXEC_MJ_TESTOUTER)
* (EXEC_MJ_TESTOUTER)
*********************************/
*------------------------------------------------
*/
case
EXEC_MJ_NEXTOUTER
:
case
EXEC_MJ_NEXTOUTER
:
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_NEXTOUTER
\n
"
);
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_NEXTOUTER
\n
"
);
...
@@ -657,7 +662,7 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -657,7 +662,7 @@ ExecMergeJoin(MergeJoin *node)
mergestate
->
mj_JoinState
=
EXEC_MJ_TESTOUTER
;
mergestate
->
mj_JoinState
=
EXEC_MJ_TESTOUTER
;
break
;
break
;
/*
********************************
/*
--------------------------------------------------------
* EXEC_MJ_TESTOUTER If the new outer tuple and the marked
* EXEC_MJ_TESTOUTER If the new outer tuple and the marked
* tuple satisfy the merge clause then we know we have
* tuple satisfy the merge clause then we know we have
* duplicates in the outer scan so we have to restore the
* duplicates in the outer scan so we have to restore the
...
@@ -689,7 +694,8 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -689,7 +694,8 @@ ExecMergeJoin(MergeJoin *node)
*
*
* new outer tuple > marked tuple
* new outer tuple > marked tuple
*
*
*********************************/
*---------------------------------------------------------
*/
case
EXEC_MJ_TESTOUTER
:
case
EXEC_MJ_TESTOUTER
:
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_TESTOUTER
\n
"
);
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_TESTOUTER
\n
"
);
...
@@ -760,7 +766,7 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -760,7 +766,7 @@ ExecMergeJoin(MergeJoin *node)
}
}
break
;
break
;
/*
********************************
/*
----------------------------------------------------------
* EXEC_MJ_SKIPOUTER means skip over tuples in the outer plan
* EXEC_MJ_SKIPOUTER means skip over tuples in the outer plan
* until we find an outer tuple > current inner tuple.
* until we find an outer tuple > current inner tuple.
*
*
...
@@ -775,7 +781,8 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -775,7 +781,8 @@ ExecMergeJoin(MergeJoin *node)
*
*
* we have to advance the outer scan
* we have to advance the outer scan
* until we find the outer 8.
* until we find the outer 8.
*********************************/
*----------------------------------------------------------
*/
case
EXEC_MJ_SKIPOUTER
:
case
EXEC_MJ_SKIPOUTER
:
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_SKIPOUTER
\n
"
);
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_SKIPOUTER
\n
"
);
/* ----------------
/* ----------------
...
@@ -867,7 +874,7 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -867,7 +874,7 @@ ExecMergeJoin(MergeJoin *node)
mergestate
->
mj_JoinState
=
EXEC_MJ_JOINMARK
;
mergestate
->
mj_JoinState
=
EXEC_MJ_JOINMARK
;
break
;
break
;
/*
********************************
/*
-----------------------------------------------------------
* EXEC_MJ_SKIPINNER means skip over tuples in the inner plan
* EXEC_MJ_SKIPINNER means skip over tuples in the inner plan
* until we find an inner tuple > current outer tuple.
* until we find an inner tuple > current outer tuple.
*
*
...
@@ -883,7 +890,8 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -883,7 +890,8 @@ ExecMergeJoin(MergeJoin *node)
* we have to advance the inner scan
* we have to advance the inner scan
* until we find the inner 12.
* until we find the inner 12.
*
*
*********************************/
*-------------------------------------------------------
*/
case
EXEC_MJ_SKIPINNER
:
case
EXEC_MJ_SKIPINNER
:
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_SKIPINNER
\n
"
);
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_SKIPINNER
\n
"
);
/* ----------------
/* ----------------
...
@@ -997,11 +1005,13 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -997,11 +1005,13 @@ ExecMergeJoin(MergeJoin *node)
break
;
break
;
#ifdef ENABLE_OUTER_JOINS
#ifdef ENABLE_OUTER_JOINS
/*********************************
* EXEC_MJ_FILLINNER means we have an unmatched inner tuple
/*
* which must be null-expanded into the projection tuple.
* EXEC_MJ_FILLINNER means we have an unmatched inner
* get the next inner tuple and reset markers (EXEC_MJ_JOINMARK).
* tuple which must be null-expanded into the projection
*********************************/
* tuple. get the next inner tuple and reset markers
* (EXEC_MJ_JOINMARK).
*/
case
EXEC_MJ_FILLINNER
:
case
EXEC_MJ_FILLINNER
:
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_FILLINNER
\n
"
);
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_FILLINNER
\n
"
);
mergestate
->
mj_JoinState
=
EXEC_MJ_JOINMARK
;
mergestate
->
mj_JoinState
=
EXEC_MJ_JOINMARK
;
...
@@ -1046,11 +1056,12 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -1046,11 +1056,12 @@ ExecMergeJoin(MergeJoin *node)
*/
*/
break
;
break
;
/*********************************
/*
* EXEC_MJ_FILLOUTER means we have an unmatched outer tuple
* EXEC_MJ_FILLOUTER means we have an unmatched outer
* which must be null-expanded into the projection tuple.
* tuple which must be null-expanded into the projection
* get the next outer tuple and reset markers (EXEC_MJ_JOINMARK).
* tuple. get the next outer tuple and reset markers
*********************************/
* (EXEC_MJ_JOINMARK).
*/
case
EXEC_MJ_FILLOUTER
:
case
EXEC_MJ_FILLOUTER
:
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_FILLOUTER
\n
"
);
MJ_printf
(
"ExecMergeJoin: EXEC_MJ_FILLOUTER
\n
"
);
mergestate
->
mj_JoinState
=
EXEC_MJ_JOINMARK
;
mergestate
->
mj_JoinState
=
EXEC_MJ_JOINMARK
;
...
@@ -1095,10 +1106,10 @@ ExecMergeJoin(MergeJoin *node)
...
@@ -1095,10 +1106,10 @@ ExecMergeJoin(MergeJoin *node)
break
;
break
;
#endif
#endif
/*
********************************
/*
* if we get here it means our code is fouled up
* if we get here it means our code is fouled up
and so we
*
and so we
just end the join prematurely.
* just end the join prematurely.
*
********************************
/
*/
default:
default:
elog
(
NOTICE
,
"ExecMergeJoin: invalid join state. aborting"
);
elog
(
NOTICE
,
"ExecMergeJoin: invalid join state. aborting"
);
return
NULL
;
return
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment