Skip to content

Commit eb87e74

Browse files
author
Alena Rybakina
committed
Add processing cases with selectivities are equal as -1.
Add assert check on NaN values.
1 parent c297fec commit eb87e74

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

hash.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ get_fss_for_object(List *relsigns, List *clauselist,
260260
if (nfeatures != NULL)
261261
{
262262
(*features)[inverse_idx[i]] = log(*s);
263+
Assert(!isnan(log(*s)));
263264
if ((*features)[inverse_idx[i]] < log_selectivity_lower_bound)
264265
(*features)[inverse_idx[i]] = log_selectivity_lower_bound;
265266
}
@@ -693,7 +694,7 @@ get_eclasses(List *clauselist, int *nargs, int **args_hash, int **eclass_hash)
693694
e_hashes = palloc((*nargs) * sizeof(*e_hashes));
694695

695696
MemoryContextSwitchTo(old_ctx_m);
696-
697+
697698
for (i = 0; i < *nargs; ++i)
698699
lsts[i] = NIL;
699700

machine_learning.c

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

7171
for (i = 0; i < len; ++i)
72+
{
73+
Assert(!isnan(a[i]));
7274
res += (a[i] - b[i]) * (a[i] - b[i]);
75+
}
7376
if (len != 0)
7477
res = sqrt(res / len);
7578
return res;

postprocessing.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ restore_selectivities(List *clauselist, List *relidslist, JoinType join_type,
214214
else
215215
cur_sel = &rinfo->outer_selec;
216216

217+
if (*cur_sel < 0)
218+
*cur_sel = 0;
219+
220+
Assert(cur_sel > 0);
221+
217222
lst = lappend(lst, cur_sel);
218223
i++;
219224
}

storage.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ form_matrix(double *matrix, int nrows, int ncols)
145145
elems = palloc(sizeof(*elems) * nrows * ncols);
146146
for (i = 0; i < nrows; ++i)
147147
for (j = 0; j < ncols; ++j)
148+
{
148149
elems[i * ncols + j] = Float8GetDatum(matrix[i * ncols + j]);
150+
Assert(!isnan(matrix[i * ncols + j]));
151+
}
149152

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy