@@ -412,7 +412,7 @@ DistExec_Init_methods(void)
412412 /* Initialize path generator methods */
413413 distplanexec_path_methods .CustomName = DISTEXECPATHNAME ;
414414 distplanexec_path_methods .PlanCustomPath = CreateDistExecPlan ;
415- distplanexec_path_methods .ReparameterizeCustomPathByChild = NULL ;
415+ distplanexec_path_methods .ReparameterizeCustomPathByChild = NULL ;
416416
417417 distplanexec_plan_methods .CustomName = "DistExecPlan" ;
418418 distplanexec_plan_methods .CreateCustomScanState = CreateDistPlanExecState ;
@@ -440,6 +440,7 @@ make_distplanexec(List *custom_plans, List *tlist, List *private_data)
440440 CustomScan * node = makeNode (CustomScan );
441441 Plan * plan = & node -> scan .plan ;
442442 ListCell * lc ;
443+ List * child_tlist ;
443444
444445 plan -> startup_cost = 10 ;
445446 plan -> total_cost = 10 ;
@@ -454,9 +455,11 @@ make_distplanexec(List *custom_plans, List *tlist, List *private_data)
454455
455456 /* Setup methods and child plan */
456457 node -> methods = & distplanexec_plan_methods ;
457- node -> custom_scan_tlist = tlist ;
458458 node -> scan .scanrelid = 0 ;
459459 node -> custom_plans = custom_plans ;
460+
461+ child_tlist = ((Plan * )linitial (node -> custom_plans ))-> targetlist ;
462+ node -> custom_scan_tlist = child_tlist ;
460463 node -> custom_exprs = NIL ;
461464 node -> custom_private = NIL ;
462465
@@ -471,7 +474,7 @@ make_distplanexec(List *custom_plans, List *tlist, List *private_data)
471474 return node ;
472475}
473476
474- Path *
477+ CustomPath *
475478create_distexec_path (PlannerInfo * root , RelOptInfo * rel , Path * children ,
476479 Bitmapset * servers )
477480{
@@ -480,27 +483,29 @@ create_distexec_path(PlannerInfo *root, RelOptInfo *rel, Path *children,
480483 int member = -1 ;
481484
482485 pathnode -> pathtype = T_CustomScan ;
483- pathnode -> parent = rel ;
484486 pathnode -> pathtarget = rel -> reltarget ;
485487 pathnode -> param_info = NULL ;
488+ pathnode -> parent = rel ;
486489
487490 pathnode -> parallel_aware = false; /* permanently */
488491 pathnode -> parallel_safe = false; /* permanently */
489492 pathnode -> parallel_workers = 0 ; /* permanently */
490493 pathnode -> pathkeys = NIL ;
491494
492- pathnode -> rows = rel -> tuples ;
493- pathnode -> startup_cost = 10 ;
494- pathnode -> total_cost = 10 ;
495-
496495 path -> flags = 0 ;
497496 path -> custom_paths = lappend (path -> custom_paths , children );
497+ path -> custom_private = NIL ;
498498
499499 while ((member = bms_next_member (servers , member )) >= 0 )
500500 path -> custom_private = lappend_oid (path -> custom_private , (Oid ) member );
501501
502502 path -> methods = & distplanexec_path_methods ;
503- return pathnode ;
503+
504+ pathnode -> rows = children -> rows ;
505+ pathnode -> startup_cost = 100. ;
506+ pathnode -> total_cost = pathnode -> startup_cost ;
507+
508+ return path ;
504509}
505510
506511bool
0 commit comments