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
f0e7e2fa
Commit
f0e7e2fa
authored
Feb 23, 1998
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ExecReScan for Unique & Sort nodes.
parent
e4fd5346
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
11 deletions
+83
-11
src/backend/executor/execAmi.c
src/backend/executor/execAmi.c
+10
-1
src/backend/executor/nodeSort.c
src/backend/executor/nodeSort.c
+26
-3
src/backend/executor/nodeUnique.c
src/backend/executor/nodeUnique.c
+17
-1
src/backend/utils/sort/psort.c
src/backend/utils/sort/psort.c
+24
-3
src/include/executor/nodeSort.h
src/include/executor/nodeSort.h
+2
-1
src/include/executor/nodeUnique.h
src/include/executor/nodeUnique.h
+2
-1
src/include/utils/psort.h
src/include/utils/psort.h
+2
-1
No files found.
src/backend/executor/execAmi.c
View file @
f0e7e2fa
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.1
7 1998/02/13 03:26:36
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.1
8 1998/02/23 06:26:53
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
#include "executor/nodeHash.h"
#include "executor/nodeHash.h"
#include "executor/nodeAgg.h"
#include "executor/nodeAgg.h"
#include "executor/nodeResult.h"
#include "executor/nodeResult.h"
#include "executor/nodeUnique.h"
#include "executor/nodeSubplan.h"
#include "executor/nodeSubplan.h"
#include "executor/execdebug.h"
#include "executor/execdebug.h"
#include "optimizer/internal.h"
/* for _TEMP_RELATION_ID_ */
#include "optimizer/internal.h"
/* for _TEMP_RELATION_ID_ */
...
@@ -354,6 +355,14 @@ ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent)
...
@@ -354,6 +355,14 @@ ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent)
ExecReScanResult
((
Result
*
)
node
,
exprCtxt
,
parent
);
ExecReScanResult
((
Result
*
)
node
,
exprCtxt
,
parent
);
break
;
break
;
case
T_Unique
:
ExecReScanUnique
((
Unique
*
)
node
,
exprCtxt
,
parent
);
break
;
case
T_Sort
:
ExecReScanSort
((
Sort
*
)
node
,
exprCtxt
,
parent
);
break
;
/*
/*
* Tee is never used
* Tee is never used
case T_Tee:
case T_Tee:
...
...
src/backend/executor/nodeSort.c
View file @
f0e7e2fa
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.1
2 1998/01/07 21:02:56 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.1
3 1998/02/23 06:26:56 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -183,8 +183,6 @@ ExecSort(Sort *node)
...
@@ -183,8 +183,6 @@ ExecSort(Sort *node)
else
else
{
{
slot
=
(
TupleTableSlot
*
)
sortstate
->
csstate
.
cstate
.
cs_ResultTupleSlot
;
slot
=
(
TupleTableSlot
*
)
sortstate
->
csstate
.
cstate
.
cs_ResultTupleSlot
;
/* *** get_cs_ResultTupleSlot((CommonState) sortstate); */
/* slot = sortstate->csstate.css_ScanTupleSlot; orig */
}
}
SO1_printf
(
"ExecSort: %s
\n
"
,
SO1_printf
(
"ExecSort: %s
\n
"
,
...
@@ -390,3 +388,28 @@ ExecSortRestrPos(Sort *node)
...
@@ -390,3 +388,28 @@ ExecSortRestrPos(Sort *node)
*/
*/
psort_restorepos
(
node
);
psort_restorepos
(
node
);
}
}
void
ExecReScanSort
(
Sort
*
node
,
ExprContext
*
exprCtxt
,
Plan
*
parent
)
{
SortState
*
sortstate
=
node
->
sortstate
;
/*
* If we haven't sorted yet, just return. If outerplan'
* chgParam is not NULL then it will be re-scanned by
* ExecProcNode, else - no reason to re-scan it at all.
*/
if
(
sortstate
->
sort_Flag
==
false
)
return
;
ExecClearTuple
(
sortstate
->
csstate
.
cstate
.
cs_ResultTupleSlot
);
psort_rescan
(
node
);
/*
* If subnode is to be rescanned then we aren't sorted
*/
if
(((
Plan
*
)
node
)
->
lefttree
->
chgParam
!=
NULL
)
sortstate
->
sort_Flag
=
false
;
}
src/backend/executor/nodeUnique.c
View file @
f0e7e2fa
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.1
5 1998/02/18 12:40:44
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.1
6 1998/02/23 06:26:58
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -355,3 +355,19 @@ ExecEndUnique(Unique *node)
...
@@ -355,3 +355,19 @@ ExecEndUnique(Unique *node)
ExecEndNode
(
outerPlan
((
Plan
*
)
node
),
(
Plan
*
)
node
);
ExecEndNode
(
outerPlan
((
Plan
*
)
node
),
(
Plan
*
)
node
);
ExecClearTuple
(
uniquestate
->
cs_ResultTupleSlot
);
ExecClearTuple
(
uniquestate
->
cs_ResultTupleSlot
);
}
}
void
ExecReScanUnique
(
Unique
*
node
,
ExprContext
*
exprCtxt
,
Plan
*
parent
)
{
UniqueState
*
uniquestate
=
node
->
uniquestate
;
ExecClearTuple
(
uniquestate
->
cs_ResultTupleSlot
);
/*
* if chgParam of subnode is not null then plan
* will be re-scanned by first ExecProcNode.
*/
if
(((
Plan
*
)
node
)
->
lefttree
->
chgParam
==
NULL
)
ExecReScan
(((
Plan
*
)
node
)
->
lefttree
,
exprCtxt
,
(
Plan
*
)
node
);
}
src/backend/utils/sort/psort.c
View file @
f0e7e2fa
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.3
7 1998/02/11 19:13:47 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.3
8 1998/02/23 06:27:39 vadim
Exp $
*
*
* NOTES
* NOTES
* Sorts the first relation into the second relation.
* Sorts the first relation into the second relation.
...
@@ -924,8 +924,6 @@ psort_end(Sort * node)
...
@@ -924,8 +924,6 @@ psort_end(Sort * node)
if
(
!
node
->
cleaned
)
if
(
!
node
->
cleaned
)
{
{
Assert
(
node
!=
(
Sort
*
)
NULL
);
/*
/*
* I'm changing this because if we are sorting a relation with no
* I'm changing this because if we are sorting a relation with no
* tuples, psortstate is NULL.
* tuples, psortstate is NULL.
...
@@ -944,12 +942,35 @@ psort_end(Sort * node)
...
@@ -944,12 +942,35 @@ psort_end(Sort * node)
(
int
)
ceil
((
double
)
PS
(
node
)
->
BytesWritten
/
BLCKSZ
);
(
int
)
ceil
((
double
)
PS
(
node
)
->
BytesWritten
/
BLCKSZ
);
pfree
((
void
*
)
node
->
psortstate
);
pfree
((
void
*
)
node
->
psortstate
);
node
->
psortstate
=
NULL
;
node
->
cleaned
=
TRUE
;
node
->
cleaned
=
TRUE
;
}
}
}
}
}
}
void
psort_rescan
(
Sort
*
node
)
{
/*
* If subnode is to be rescanned then free our previous results
*/
if
(((
Plan
*
)
node
)
->
lefttree
->
chgParam
!=
NULL
)
{
psort_end
(
node
);
node
->
cleaned
=
false
;
}
else
if
(
PS
(
node
)
!=
(
Psortstate
*
)
NULL
)
{
PS
(
node
)
->
all_fetched
=
false
;
PS
(
node
)
->
psort_current
=
0
;
PS
(
node
)
->
psort_saved
=
0
;
if
(
PS
(
node
)
->
using_tape_files
==
true
)
rewind
(
PS
(
node
)
->
psort_grab_file
);
}
}
/*
/*
* gettape - handles access temporary files in polyphase merging
* gettape - handles access temporary files in polyphase merging
*
*
...
...
src/include/executor/nodeSort.h
View file @
f0e7e2fa
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: nodeSort.h,v 1.
5 1997/11/26 01:13:04 momjian
Exp $
* $Id: nodeSort.h,v 1.
6 1998/02/23 06:27:55 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -23,5 +23,6 @@ extern int ExecCountSlotsSort(Sort *node);
...
@@ -23,5 +23,6 @@ extern int ExecCountSlotsSort(Sort *node);
extern
void
ExecEndSort
(
Sort
*
node
);
extern
void
ExecEndSort
(
Sort
*
node
);
extern
void
ExecSortMarkPos
(
Sort
*
node
);
extern
void
ExecSortMarkPos
(
Sort
*
node
);
extern
void
ExecSortRestrPos
(
Sort
*
node
);
extern
void
ExecSortRestrPos
(
Sort
*
node
);
extern
void
ExecReScanSort
(
Sort
*
node
,
ExprContext
*
exprCtxt
,
Plan
*
parent
);
#endif
/* NODESORT_H */
#endif
/* NODESORT_H */
src/include/executor/nodeUnique.h
View file @
f0e7e2fa
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: nodeUnique.h,v 1.
5 1997/11/26 01:13:06 momjian
Exp $
* $Id: nodeUnique.h,v 1.
6 1998/02/23 06:27:56 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -21,5 +21,6 @@ extern TupleTableSlot *ExecUnique(Unique *node);
...
@@ -21,5 +21,6 @@ extern TupleTableSlot *ExecUnique(Unique *node);
extern
bool
ExecInitUnique
(
Unique
*
node
,
EState
*
estate
,
Plan
*
parent
);
extern
bool
ExecInitUnique
(
Unique
*
node
,
EState
*
estate
,
Plan
*
parent
);
extern
int
ExecCountSlotsUnique
(
Unique
*
node
);
extern
int
ExecCountSlotsUnique
(
Unique
*
node
);
extern
void
ExecEndUnique
(
Unique
*
node
);
extern
void
ExecEndUnique
(
Unique
*
node
);
extern
void
ExecReScanUnique
(
Unique
*
node
,
ExprContext
*
exprCtxt
,
Plan
*
parent
);
#endif
/* NODEUNIQUE_H */
#endif
/* NODEUNIQUE_H */
src/include/utils/psort.h
View file @
f0e7e2fa
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: psort.h,v 1.1
4 1997/10/15 06:36:3
6 vadim Exp $
* $Id: psort.h,v 1.1
5 1998/02/23 06:28:1
6 vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -104,5 +104,6 @@ extern HeapTuple psort_grabtuple(Sort *node, bool *should_free);
...
@@ -104,5 +104,6 @@ extern HeapTuple psort_grabtuple(Sort *node, bool *should_free);
extern
void
psort_markpos
(
Sort
*
node
);
extern
void
psort_markpos
(
Sort
*
node
);
extern
void
psort_restorepos
(
Sort
*
node
);
extern
void
psort_restorepos
(
Sort
*
node
);
extern
void
psort_end
(
Sort
*
node
);
extern
void
psort_end
(
Sort
*
node
);
extern
void
psort_rescan
(
Sort
*
node
);
#endif
/* PSORT_H */
#endif
/* PSORT_H */
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