Skip to content

Commit 53b3910

Browse files
Alena Rybakinapyhalov
authored andcommitted
Add processing cases with selectivities are equal as -1.
Add assert check on NaN values.
1 parent 89c834d commit 53b3910

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

hash.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ get_fss_for_object(List *relidslist, List *clauselist,
228228
if (nfeatures != NULL)
229229
{
230230
(*features)[inverse_idx[i]] = log(*s);
231+
Assert(!isnan(log(*s)));
231232
if ((*features)[inverse_idx[i]] < log_selectivity_lower_bound)
232233
(*features)[inverse_idx[i]] = log_selectivity_lower_bound;
233234
}

machine_learning.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ fs_distance(double *a, double *b, int len)
3838
int i;
3939

4040
for (i = 0; i < len; ++i)
41+
{
42+
Assert(!isnan(a[i]));
4143
res += (a[i] - b[i]) * (a[i] - b[i]);
44+
}
4245
if (len != 0)
4346
res = sqrt(res / len);
4447
return res;

postprocessing.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ restore_selectivities(List *clauselist,
239239
else
240240
cur_sel = &rinfo->outer_selec;
241241

242+
if (*cur_sel < 0)
243+
*cur_sel = 0;
244+
245+
Assert(*cur_sel >= 0);
246+
242247
lst = lappend(lst, cur_sel);
243248
i++;
244249
}

storage.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,10 @@ form_matrix(double **matrix, int nrows, int ncols)
811811
elems = palloc(sizeof(*elems) * nrows * ncols);
812812
for (i = 0; i < nrows; ++i)
813813
for (j = 0; j < ncols; ++j)
814+
{
814815
elems[i * ncols + j] = Float8GetDatum(matrix[i][j]);
816+
Assert(!isnan(matrix[i][j]));
817+
}
815818

816819
array = construct_md_array(elems, NULL, 2, dims, lbs,
817820
FLOAT8OID, 8, FLOAT8PASSBYVAL, 'd');

0 commit comments

Comments
 (0)