Skip to content

Commit cccc65c

Browse files
committed
rename ArrangeAppend to RuntimeMergeAppend
1 parent 474338a commit cccc65c

File tree

7 files changed

+169
-145
lines changed

7 files changed

+169
-145
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# contrib/pg_pathman/Makefile
22

33
MODULE_big = pg_pathman
4-
OBJS = init.o utils.o runtimeappend.o arrangeappend.o pg_pathman.o dsm_array.o \
4+
OBJS = init.o utils.o runtimeappend.o runtime_merge_append.o pg_pathman.o dsm_array.o \
55
rangeset.o pl_funcs.o worker.o hooks.o nodes_common.o $(WIN32RES)
66

77
EXTENSION = pg_pathman

arrangeappend.h

Lines changed: 0 additions & 61 deletions
This file was deleted.

hooks.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "utils.h"
1515
#include "pathman.h"
1616
#include "runtimeappend.h"
17-
#include "arrangeappend.h"
17+
#include "runtime_merge_append.h"
1818

1919

2020
set_join_pathlist_hook_type set_join_pathlist_next = NULL;
@@ -267,15 +267,16 @@ pathman_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTb
267267
set_append_rel_pathlist(root, rel, rti, rte, pathkeyAsc, pathkeyDesc);
268268
set_append_rel_size(root, rel, rti, rte);
269269

270-
if (!pg_pathman_enable_runtimeappend)
270+
if (!(pg_pathman_enable_runtimeappend ||
271+
pg_pathman_enable_runtime_merge_append))
271272
return;
272273

273274
foreach (lc, rel->pathlist)
274275
{
275276
AppendPath *cur_path = (AppendPath *) lfirst(lc);
276277
Relids inner_required = PATH_REQ_OUTER((Path *) cur_path);
277278
ParamPathInfo *ppi = get_appendrel_parampathinfo(rel, inner_required);
278-
Path *inner_path;
279+
Path *inner_path = NULL;
279280
ListCell *subpath_cell;
280281
List *runtime_quals = NIL;
281282

@@ -324,16 +325,18 @@ pathman_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTb
324325
if (runtime_quals == NIL)
325326
continue;
326327

327-
if (IsA(cur_path, AppendPath))
328+
if (IsA(cur_path, AppendPath) && pg_pathman_enable_runtimeappend)
328329
inner_path = create_runtimeappend_path(root, cur_path,
329330
ppi, runtime_quals,
330331
paramsel);
331-
else
332-
inner_path = create_arrangeappend_path(root, cur_path,
333-
ppi, runtime_quals,
334-
paramsel);
335-
336-
add_path(rel, inner_path);
332+
else if (IsA(cur_path, MergeAppendPath) &&
333+
pg_pathman_enable_runtime_merge_append)
334+
inner_path = create_runtimemergeappend_path(root, cur_path,
335+
ppi, runtime_quals,
336+
paramsel);
337+
338+
if (inner_path)
339+
add_path(rel, inner_path);
337340
}
338341
}
339342
}

pg_pathman.c

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#include "foreign/fdwapi.h"
4242
#include "hooks.h"
4343
#include "runtimeappend.h"
44-
#include "arrangeappend.h"
44+
#include "runtime_merge_append.h"
4545

4646
PG_MODULE_MAGIC;
4747

@@ -173,20 +173,20 @@ _PG_init(void)
173173
runtimeappend_exec_methods.ExplainCustomScan = runtimeappend_explain;
174174

175175
/* RuntimeMergeAppend */
176-
arrangeappend_path_methods.CustomName = "RuntimeMergeAppend";
177-
arrangeappend_path_methods.PlanCustomPath = create_arrangeappend_plan;
176+
runtime_merge_append_path_methods.CustomName = "RuntimeMergeAppend";
177+
runtime_merge_append_path_methods.PlanCustomPath = create_runtimemergeappend_plan;
178178

179-
arrangeappend_plan_methods.CustomName = "RuntimeMergeAppend";
180-
arrangeappend_plan_methods.CreateCustomScanState = arrangeappend_create_scan_state;
179+
runtime_merge_append_plan_methods.CustomName = "RuntimeMergeAppend";
180+
runtime_merge_append_plan_methods.CreateCustomScanState = runtimemergeappend_create_scan_state;
181181

182-
arrangeappend_exec_methods.CustomName = "RuntimeMergeAppend";
183-
arrangeappend_exec_methods.BeginCustomScan = arrangeappend_begin;
184-
arrangeappend_exec_methods.ExecCustomScan = arrangeappend_exec;
185-
arrangeappend_exec_methods.EndCustomScan = arrangeappend_end;
186-
arrangeappend_exec_methods.ReScanCustomScan = arrangeappend_rescan;
187-
arrangeappend_exec_methods.MarkPosCustomScan = NULL;
188-
arrangeappend_exec_methods.RestrPosCustomScan = NULL;
189-
arrangeappend_exec_methods.ExplainCustomScan = arrangeappend_explain;
182+
runtime_merge_append_exec_methods.CustomName = "RuntimeMergeAppend";
183+
runtime_merge_append_exec_methods.BeginCustomScan = runtimemergeappend_begin;
184+
runtime_merge_append_exec_methods.ExecCustomScan = runtimemergeappend_exec;
185+
runtime_merge_append_exec_methods.EndCustomScan = runtimemergeappend_end;
186+
runtime_merge_append_exec_methods.ReScanCustomScan = runtimemergeappend_rescan;
187+
runtime_merge_append_exec_methods.MarkPosCustomScan = NULL;
188+
runtime_merge_append_exec_methods.RestrPosCustomScan = NULL;
189+
runtime_merge_append_exec_methods.ExplainCustomScan = runtimemergeappend_explain;
190190

191191
DefineCustomBoolVariable("pg_pathman.enable",
192192
"Enables pg_pathman's optimizations during the planner stage",
@@ -209,6 +209,17 @@ _PG_init(void)
209209
NULL,
210210
NULL,
211211
NULL);
212+
213+
DefineCustomBoolVariable("pg_pathman.enable_runtimemergeappend",
214+
"Enables the planner's use of RuntimeMergeAppend custom node.",
215+
NULL,
216+
&pg_pathman_enable_runtime_merge_append,
217+
true,
218+
PGC_USERSET,
219+
0,
220+
NULL,
221+
NULL,
222+
NULL);
212223
}
213224

214225
PartRelationInfo *

0 commit comments

Comments
 (0)