Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit9275817

Browse files
committed
fix some annoying bugs
1 parentbd54b37 commit9275817

File tree

3 files changed

+42
-18
lines changed

3 files changed

+42
-18
lines changed

‎arrangeappend.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ static void
104104
pack_arrangeappend_private(CustomScan*cscan,MergeAppendGuts*mag)
105105
{
106106
List*arrangeappend_private=NIL;
107-
List*sortColIdx,
108-
*sortOperators,
109-
*collations,
110-
*nullsFirst;
107+
List*sortColIdx=NIL,
108+
*sortOperators=NIL,
109+
*collations=NIL,
110+
*nullsFirst=NIL;
111111
inti;
112112

113113
for (i=0;i<mag->numCols;i++)
@@ -149,13 +149,13 @@ unpack_arrangeappend_private(ArrangeAppendState *scan_state, CustomScan *cscan)
149149
*collations,
150150
*nullsFirst;
151151

152-
scan_state->numCols=intVal(linitial(cscan->custom_private));
153-
arrangeappend_private=lsecond(cscan->custom_private);
152+
arrangeappend_private=linitial(cscan->custom_private);
153+
scan_state->numCols=intVal(linitial(arrangeappend_private));
154154

155-
sortColIdx=linitial(arrangeappend_private);
156-
sortOperators=lsecond(arrangeappend_private);
157-
collations=lthird(arrangeappend_private);
158-
nullsFirst=lfourth(arrangeappend_private);
155+
sortColIdx=linitial(lsecond(arrangeappend_private));
156+
sortOperators=lsecond(lsecond(arrangeappend_private));
157+
collations=lthird(lsecond(arrangeappend_private));
158+
nullsFirst=lfourth(lsecond(arrangeappend_private));
159159

160160
FillStateField(sortColIdx,AttrNumber,lfirst_int);
161161
FillStateField(sortOperators,Oid,lfirst_oid);
@@ -278,7 +278,7 @@ create_arrangeappend_plan(PlannerInfo *root, RelOptInfo *rel,
278278

279279
/* TODO: write node_XXX wariables to custom_private */
280280

281-
pack_arrangeappend_private(node,NULL);
281+
pack_arrangeappend_private(node,&mag);
282282

283283
returnplan;
284284
}

‎hooks.c

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

1819

1920
set_join_pathlist_hook_typeset_join_pathlist_next=NULL;
@@ -129,7 +130,7 @@ pathman_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTb
129130
boolfound;
130131
intlen;
131132
intfirst_child_relid=0;
132-
133+
133134
/* Invoke original hook if needed */
134135
if (set_rel_pathlist_hook_next!=NULL)
135136
set_rel_pathlist_hook_next(root,rel,rti,rte);
@@ -268,7 +269,7 @@ pathman_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTb
268269

269270
if (!pg_pathman_enable_runtimeappend)
270271
return;
271-
272+
272273
foreach (lc,rel->pathlist)
273274
{
274275
AppendPath*cur_path= (AppendPath*)lfirst(lc);
@@ -278,13 +279,13 @@ pathman_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTb
278279
ListCell*subpath_cell;
279280
List*runtime_quals=NIL;
280281

281-
if (!IsA(cur_path,AppendPath)||
282+
if (!(IsA(cur_path,AppendPath)||IsA(cur_path,MergeAppendPath))||
282283
rel->has_eclass_joins||
283284
rel->joininfo)
284285
{
285286
continue;
286287
}
287-
288+
288289
foreach (subpath_cell,cur_path->subpaths)
289290
{
290291
Path*subpath= (Path*)lfirst(subpath_cell);
@@ -323,9 +324,14 @@ pathman_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTb
323324
if (runtime_quals==NIL)
324325
continue;
325326

326-
inner_path=create_runtimeappend_path(root,cur_path,
327-
ppi,runtime_quals,
328-
paramsel);
327+
if (IsA(cur_path,AppendPath))
328+
inner_path=create_runtimeappend_path(root,cur_path,
329+
ppi,runtime_quals,
330+
paramsel);
331+
else
332+
inner_path=create_arrangeappend_path(root,cur_path,
333+
ppi,runtime_quals,
334+
paramsel);
329335

330336
add_path(rel,inner_path);
331337
}

‎pg_pathman.c

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

4546
PG_MODULE_MAGIC;
4647

@@ -155,6 +156,7 @@ _PG_init(void)
155156
planner_hook_original=planner_hook;
156157
planner_hook=pathman_planner_hook;
157158

159+
/* RuntimeAppend */
158160
runtimeappend_path_methods.CustomName="RuntimeAppend";
159161
runtimeappend_path_methods.PlanCustomPath=create_runtimeappend_plan;
160162

@@ -170,6 +172,22 @@ _PG_init(void)
170172
runtimeappend_exec_methods.RestrPosCustomScan=NULL;
171173
runtimeappend_exec_methods.ExplainCustomScan=runtimeappend_explain;
172174

175+
/* RuntimeMergeAppend */
176+
arrangeappend_path_methods.CustomName="RuntimeMergeAppend";
177+
arrangeappend_path_methods.PlanCustomPath=create_arrangeappend_plan;
178+
179+
arrangeappend_plan_methods.CustomName="RuntimeMergeAppend";
180+
arrangeappend_plan_methods.CreateCustomScanState=arrangeappend_create_scan_state;
181+
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;
190+
173191
DefineCustomBoolVariable("pg_pathman.enable",
174192
"Enables pg_pathman's optimizations during the planner stage",
175193
NULL,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp