Skip to content

Commit

Permalink
bugfix: unable to EXPLAIN pp_info->scan_quals if setrefs.c modified V…
Browse files Browse the repository at this point in the history
…ar with rtoffset > 0

todo: Is other expressions safe for EXPLAIN?
  • Loading branch information
kaigai committed Mar 8, 2024
1 parent e42561e commit cc73ea3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/executor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2277,9 +2277,9 @@ pgstromExplainTaskState(CustomScanState *node,
/* xPU Scan Quals */
if (ps_state)
stat_ntuples = pg_atomic_read_u64(&ps_state->source_ntuples_in);
if (pp_info->scan_quals)
if (pp_info->scan_quals_explain)
{
List *scan_quals = pp_info->scan_quals;
List *scan_quals = pp_info->scan_quals_explain;
Expr *expr;

resetStringInfo(&buf);
Expand Down
1 change: 1 addition & 0 deletions src/gpu_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ __buildSimpleScanPlanInfo(PlannerInfo *root,
pp_info->scan_relid = baserel->relid;
pp_info->host_quals = extract_actual_clauses(host_quals, false);
pp_info->scan_quals = extract_actual_clauses(dev_quals, false);
pp_info->scan_quals_explain = copyObject(pp_info->scan_quals);
pp_info->scan_tuples = baserel->tuples;
pp_info->scan_nrows = scan_nrows;
pp_info->parallel_nworkers = parallel_nworkers;
Expand Down
3 changes: 3 additions & 0 deletions src/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ form_pgstrom_plan_info(CustomScan *cscan, pgstromPlanInfo *pp_info)
privs = lappend(privs, pp_info->host_quals);
privs = lappend(privs, makeInteger(pp_info->scan_relid));
privs = lappend(privs, pp_info->scan_quals);
exprs = lappend(exprs, pp_info->scan_quals_explain);
privs = lappend(privs, __makeFloat(pp_info->scan_tuples));
privs = lappend(privs, __makeFloat(pp_info->scan_nrows));
privs = lappend(privs, makeInteger(pp_info->parallel_nworkers));
Expand Down Expand Up @@ -203,6 +204,7 @@ deform_pgstrom_plan_info(CustomScan *cscan)
pp_data.host_quals = list_nth(privs, pindex++);
pp_data.scan_relid = intVal(list_nth(privs, pindex++));
pp_data.scan_quals = list_nth(privs, pindex++);
pp_data.scan_quals_explain = list_nth(exprs, eindex++);
pp_data.scan_tuples = floatVal(list_nth(privs, pindex++));
pp_data.scan_nrows = floatVal(list_nth(privs, pindex++));
pp_data.parallel_nworkers = intVal(list_nth(privs, pindex++));
Expand Down Expand Up @@ -295,6 +297,7 @@ copy_pgstrom_plan_info(const pgstromPlanInfo *pp_orig)
pp_dest->used_params = list_copy(pp_dest->used_params);
pp_dest->host_quals = copyObject(pp_dest->host_quals);
pp_dest->scan_quals = copyObject(pp_dest->scan_quals);
pp_dest->scan_quals_explain = copyObject(pp_dest->scan_quals_explain);
pp_dest->brin_index_conds = copyObject(pp_dest->brin_index_conds);
pp_dest->brin_index_quals = copyObject(pp_dest->brin_index_quals);
foreach (lc, pp_orig->kvars_deflist)
Expand Down
1 change: 1 addition & 0 deletions src/pg_strom.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ typedef struct
List *host_quals; /* host qualifiers to scan the outer */
Index scan_relid; /* relid of the outer relation to scan */
List *scan_quals; /* device qualifiers to scan the outer */
List *scan_quals_explain; /* device qualifiers for EXPLAIN output */
double scan_tuples; /* copy of baserel->tuples */
double scan_nrows; /* copy of baserel->rows */
int parallel_nworkers; /* # of parallel workers */
Expand Down

0 comments on commit cc73ea3

Please sign in to comment.