From 2937d4edc996820aacd4f87ce865c461e5a7b6ca Mon Sep 17 00:00:00 2001 From: Nils Dijk Date: Mon, 20 Jan 2020 18:51:42 +0100 Subject: [PATCH] Fix misread of colocation id --- src/backend/distributed/planner/path_based_planner.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/distributed/planner/path_based_planner.c b/src/backend/distributed/planner/path_based_planner.c index 844fe490e..e8c303684 100644 --- a/src/backend/distributed/planner/path_based_planner.c +++ b/src/backend/distributed/planner/path_based_planner.c @@ -238,6 +238,9 @@ OptimizeJoinPath(Path *originalPath) HashPath *hpath = castNode(HashPath, originalPath); if (CanOptimizeHashPath(hpath)) { + /* we can only optimize the Distributed union if the colocationId's are the same, taking any would suffice */ + uint32 colocationId = ((DistributedUnionPath *) hpath->jpath.innerjoinpath)->colocationId; + hpath->jpath.innerjoinpath = ((DistributedUnionPath *)hpath->jpath.innerjoinpath)->worker_path; hpath->jpath.outerjoinpath = ((DistributedUnionPath *)hpath->jpath.outerjoinpath)->worker_path; @@ -245,8 +248,6 @@ OptimizeJoinPath(Path *originalPath) hpath->jpath.path.startup_cost -= 2000; /* remove the double dist union cost */ hpath->jpath.path.total_cost -= 2000; /* remove the double dist union cost */ - /* we can only optimize the Distributed union if the colocationId's are the same, taking any would suffice */ - uint32 colocationId = ((DistributedUnionPath *) hpath->jpath.innerjoinpath)->colocationId; return (Path *) WrapTableAccessWithDistributedUnion((Path *) hpath, colocationId); } }