Skip to content

Commit f2caa7c

Browse files
Alena Rybakinadanolivo
authored andcommitted
Add processing cases with selectivities are equal as -1.
Add assert check on NaN values.
1 parent fc80022 commit f2caa7c

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

postprocessing.c

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ restore_selectivities(List *clauselist, List *relidslist, JoinType join_type,
176176
int nargs;
177177
int *args_hash;
178178
int *eclass_hash;
179-
double *cur_sel;
180179
int cur_hash;
181180
int cur_relid;
182181

@@ -191,31 +190,27 @@ restore_selectivities(List *clauselist, List *relidslist, JoinType join_type,
191190
foreach(l, clauselist)
192191
{
193192
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
193+
Selectivity *cur_sel = NULL;
194194

195-
cur_sel = NULL;
196195
if (parametrized_sel)
197196
{
198197
cur_hash = get_clause_hash(rinfo->clause, nargs,
199198
args_hash, eclass_hash);
200199
cur_sel = selectivity_cache_find_global_relid(cur_hash, cur_relid);
201-
if (cur_sel == NULL)
202-
{
203-
if (join_type == JOIN_INNER)
204-
cur_sel = &rinfo->norm_selec;
205-
else
206-
cur_sel = &rinfo->outer_selec;
207-
}
208200
}
209-
else if (join_type == JOIN_INNER)
210-
cur_sel = &rinfo->norm_selec;
211-
else
212-
cur_sel = &rinfo->outer_selec;
201+
202+
if (cur_sel == NULL)
203+
{
204+
cur_sel = palloc(sizeof(Selectivity));
205+
if (join_type == JOIN_INNER)
206+
*cur_sel = rinfo->norm_selec;
207+
else
208+
*cur_sel = rinfo->outer_selec;
209+
}
213210

214211
if (*cur_sel < 0)
215212
*cur_sel = 0;
216213

217-
Assert(cur_sel > 0);
218-
219214
lst = lappend(lst, cur_sel);
220215
}
221216

0 commit comments

Comments
 (0)