Changeset: 636653e711ae for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/636653e711ae
Modified Files:
        sql/server/rel_statistics.c
Branch: persistent_sketches
Log Message:

make sure estimates of 0 are handled


diffs (19 lines):

diff --git a/sql/server/rel_statistics.c b/sql/server/rel_statistics.c
--- a/sql/server/rel_statistics.c
+++ b/sql/server/rel_statistics.c
@@ -743,10 +743,13 @@ rel_calc_nuniques(mvc *sql, sql_rel *l, 
                                (min = find_prop_and_get(e->p, PROP_MIN)) && 
(max = find_prop_and_get(e->p, PROP_MAX))) {
                                /* the range includes min and max, so the 
atom_inc call is needed */
                                /* if 'euniques' has number of distinct values, 
compute min between both */
-                               if ((sub = atom_sub(sql->sa, max, min)) && (sub 
= atom_inc(sql->sa, sub)) && (sub = atom_cast(sql->sa, sub, 
sql_fetch_localtype(TYPE_oid))))
+                               if ((sub = atom_sub(sql->sa, max, min)) && (sub 
= atom_inc(sql->sa, sub)) && (sub = atom_cast(sql->sa, sub, 
sql_fetch_localtype(TYPE_oid)))) {
+                                       assert(0);
                                        euniques = MIN(euniques, (BUN) 
sub->data.val.oval);
+                                       printf("euniques %lu\n", euniques);
+                               }
                        }
-                       if (euniques != BUN_NONE && (euniques == 0 || nuniques 
< BUN_MAX/euniques))
+                       if (euniques != BUN_NONE && (euniques > 0 && nuniques < 
BUN_MAX/euniques))
                                nuniques = nuniques * euniques; /* the highest 
cardinality sets the estimation */
                        else
                                nuniques = BUN_NONE;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to