Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8286223

Browse filesBrowse files
committed
Fix missing outfuncs.c support for IncrementalSortPath.
For debugging purposes, Path nodes are supposed to have outfuncs support, but this was overlooked in the original incremental sort patch. While at it, clean up a couple other minor oversights, as well as bizarre choice of return type for create_incremental_sort_path(). (All the existing callers just cast it to "Path *" immediately, so they don't care, but some future caller might care.) outfuncs.c fix by Zhijie Hou, the rest by me Discussion: https://postgr.es/m/324c4d81d8134117972a5b1f6cdf9560@G08CNEXMBPEKD05.g08.fujitsu.local
1 parent 58ebe96 commit 8286223
Copy full SHA for 8286223

File tree

Expand file treeCollapse file tree

5 files changed

+34
-11
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+34
-11
lines changed

‎src/backend/nodes/outfuncs.c

Copy file name to clipboardExpand all lines: src/backend/nodes/outfuncs.c
+21-2Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,14 +1954,30 @@ _outProjectSetPath(StringInfo str, const ProjectSetPath *node)
19541954
WRITE_NODE_FIELD(subpath);
19551955
}
19561956

1957+
static void
1958+
_outSortPathInfo(StringInfo str, const SortPath *node)
1959+
{
1960+
_outPathInfo(str, (const Path *) node);
1961+
1962+
WRITE_NODE_FIELD(subpath);
1963+
}
1964+
19571965
static void
19581966
_outSortPath(StringInfo str, const SortPath *node)
19591967
{
19601968
WRITE_NODE_TYPE("SORTPATH");
19611969

1962-
_outPathInfo(str, (const Path *) node);
1970+
_outSortPathInfo(str, node);
1971+
}
19631972

1964-
WRITE_NODE_FIELD(subpath);
1973+
static void
1974+
_outIncrementalSortPath(StringInfo str, const IncrementalSortPath *node)
1975+
{
1976+
WRITE_NODE_TYPE("INCREMENTALSORTPATH");
1977+
1978+
_outSortPathInfo(str, (const SortPath *) node);
1979+
1980+
WRITE_INT_FIELD(nPresortedCols);
19651981
}
19661982

19671983
static void
@@ -4055,6 +4071,9 @@ outNode(StringInfo str, const void *obj)
40554071
case T_SortPath:
40564072
_outSortPath(str, obj);
40574073
break;
4074+
case T_IncrementalSortPath:
4075+
_outIncrementalSortPath(str, obj);
4076+
break;
40584077
case T_GroupPath:
40594078
_outGroupPath(str, obj);
40604079
break;

‎src/backend/optimizer/README

Copy file name to clipboardExpand all lines: src/backend/optimizer/README
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ RelOptInfo - a relation or joined relations
387387
ProjectionPath - a Result plan node with child (used for projection)
388388
ProjectSetPath - a ProjectSet plan node applied to some sub-path
389389
SortPath - a Sort plan node applied to some sub-path
390+
IncrementalSortPath - an IncrementalSort plan node applied to some sub-path
390391
GroupPath - a Group plan node applied to some sub-path
391392
UpperUniquePath - a Unique plan node applied to some sub-path
392393
AggPath - an Agg plan node applied to some sub-path

‎src/backend/optimizer/util/pathnode.c

Copy file name to clipboardExpand all lines: src/backend/optimizer/util/pathnode.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,7 +2798,7 @@ create_set_projection_path(PlannerInfo *root,
27982798
* 'limit_tuples' is the estimated bound on the number of output tuples,
27992799
* or -1 if no LIMIT or couldn't estimate
28002800
*/
2801-
SortPath *
2801+
IncrementalSortPath *
28022802
create_incremental_sort_path(PlannerInfo *root,
28032803
RelOptInfo *rel,
28042804
Path *subpath,
@@ -2834,7 +2834,7 @@ create_incremental_sort_path(PlannerInfo *root,
28342834

28352835
sort->nPresortedCols = presorted_keys;
28362836

2837-
return pathnode;
2837+
return sort;
28382838
}
28392839

28402840
/*

‎src/include/nodes/pathnodes.h

Copy file name to clipboardExpand all lines: src/include/nodes/pathnodes.h
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,10 @@ typedef struct SortPath
16551655
} SortPath;
16561656

16571657
/*
1658-
* IncrementalSortPath
1658+
* IncrementalSortPath represents an incremental sort step
1659+
*
1660+
* This is like a regular sort, except some leading key columns are assumed
1661+
* to be ordered already.
16591662
*/
16601663
typedef struct IncrementalSortPath
16611664
{

‎src/include/optimizer/pathnode.h

Copy file name to clipboardExpand all lines: src/include/optimizer/pathnode.h
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,17 +184,17 @@ extern ProjectSetPath *create_set_projection_path(PlannerInfo *root,
184184
RelOptInfo *rel,
185185
Path *subpath,
186186
PathTarget *target);
187-
extern SortPath *create_incremental_sort_path(PlannerInfo *root,
188-
RelOptInfo *rel,
189-
Path *subpath,
190-
List *pathkeys,
191-
int presorted_keys,
192-
double limit_tuples);
193187
extern SortPath *create_sort_path(PlannerInfo *root,
194188
RelOptInfo *rel,
195189
Path *subpath,
196190
List *pathkeys,
197191
double limit_tuples);
192+
extern IncrementalSortPath *create_incremental_sort_path(PlannerInfo *root,
193+
RelOptInfo *rel,
194+
Path *subpath,
195+
List *pathkeys,
196+
int presorted_keys,
197+
double limit_tuples);
198198
extern GroupPath *create_group_path(PlannerInfo *root,
199199
RelOptInfo *rel,
200200
Path *subpath,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.