Skip to content

Commit

Permalink
bugfix: GpuScan considered inheritance-table as if it is normal table
Browse files Browse the repository at this point in the history
issue #829

We already have partition-wise GpuJoin.
Nowadays, most people use table partitioning rather than traditional
table inheritances, and it is more functional.
So, we simply skip to add GPU-paths on the inheritance tables.
  • Loading branch information
kaigai committed Oct 17, 2024
1 parent 54176d2 commit a5cd194
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions src/gpu_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,6 @@ __try_add_partitioned_scan_path(PlannerInfo *root,
bool be_parallel)
{
List *results = NIL;
List *temp;

for (int k=0; k < baserel->nparts; k++)
{
Expand All @@ -526,18 +525,7 @@ __try_add_partitioned_scan_path(PlannerInfo *root,
RelOptInfo *leaf_rel = baserel->part_rels[k];
RangeTblEntry *rte = root->simple_rte_array[leaf_rel->relid];

if (rte->inh &&
rte->relkind == RELKIND_PARTITIONED_TABLE)
{
temp = __try_add_partitioned_scan_path(root,
leaf_rel,
xpu_task_flags,
be_parallel);
if (temp == NIL)
return NIL;
results = list_concat(results, temp);
}
else
if (!rte->inh)
{
pgstromOuterPathLeafInfo *op_leaf;

Expand All @@ -552,6 +540,18 @@ __try_add_partitioned_scan_path(PlannerInfo *root,
return NIL;
results = lappend(results, op_leaf);
}
else if (rte->relkind == RELKIND_PARTITIONED_TABLE)
{
List *temp;

temp = __try_add_partitioned_scan_path(root,
leaf_rel,
xpu_task_flags,
be_parallel);
if (temp == NIL)
return NIL;
results = list_concat(results, temp);
}
}
}
return results;
Expand Down Expand Up @@ -588,15 +588,7 @@ __xpuScanAddScanPathCommon(PlannerInfo *root,
/* Creation of GpuScan path */
for (int try_parallel=0; try_parallel < 2; try_parallel++)
{
if (rte->inh &&
rte->relkind == RELKIND_PARTITIONED_TABLE)
{
try_add_partitioned_scan_path(root,
baserel,
xpu_task_flags,
(try_parallel > 0));
}
else
if (!rte->inh)
{
try_add_simple_scan_path(root,
baserel,
Expand All @@ -607,6 +599,13 @@ __xpuScanAddScanPathCommon(PlannerInfo *root,
false, /* disallow no device quals*/
xpuscan_path_methods);
}
else if (rte->relkind == RELKIND_PARTITIONED_TABLE)
{
try_add_partitioned_scan_path(root,
baserel,
xpu_task_flags,
(try_parallel > 0));
}
if (!baserel->consider_parallel)
break;
}
Expand Down

0 comments on commit a5cd194

Please sign in to comment.