Changeset: 79698d6151c9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/79698d6151c9
Modified Files:
        sql/server/rel_statistics_functions.c
Branch: Dec2023
Log Message:

align code of sql_sub/add property propagation


diffs (38 lines):

diff --git a/sql/server/rel_statistics_functions.c 
b/sql/server/rel_statistics_functions.c
--- a/sql/server/rel_statistics_functions.c
+++ b/sql/server/rel_statistics_functions.c
@@ -86,8 +86,13 @@ sql_add_propagate_statistics(mvc *sql, s
                }
 
                if (res1 && res2) { /* if the min/max pair overflows, then 
don't propagate */
-                       set_minmax_property(sql, e, PROP_MAX, res1);
-                       set_minmax_property(sql, e, PROP_MIN, res2);
+                       if (atom_cmp(res1, res2) > 0) {
+                               set_minmax_property(sql, e, PROP_MAX, res1);
+                               set_minmax_property(sql, e, PROP_MIN, res2);
+                       } else {
+                               set_minmax_property(sql, e, PROP_MAX, res2);
+                               set_minmax_property(sql, e, PROP_MIN, res1);
+                       }
                }
                freeException(msg1);
                freeException(msg2);
@@ -191,18 +196,6 @@ sql_sub_propagate_statistics(mvc *sql, s
                }
 
                if (res1 && res2) { /* if the min/max pair overflows, then 
don't propagate */
-#if 0
-                       atom *zero1 = atom_zero_value(sql->sa, &(lmax->tpe)), 
*zero2 = atom_zero_value(sql->sa, &(rmax->tpe));
-                       int cmp1 = atom_cmp(lmax, zero1), cmp2 = atom_cmp(lmin, 
zero1), cmp3 = atom_cmp(rmin, zero2), cmp4 = atom_cmp(rmax, zero2);
-
-                       if (cmp1 >= 0 && cmp2 >= 0 && cmp3 >= 0 && cmp4 >= 0) { 
/* if all positive then propagate */
-                               set_minmax_property(sql, e, PROP_MAX, res1);
-                               set_minmax_property(sql, e, PROP_MIN, res2);
-                       } else if (cmp1 < 0 && cmp2 < 0 && cmp3 < 0 && cmp4 < 
0) { /* if all negative propagate by swapping min and max */
-                               set_minmax_property(sql, e, PROP_MAX, res2);
-                               set_minmax_property(sql, e, PROP_MIN, res1);
-                       }
-#endif
                        if (atom_cmp(res1, res2) > 0) {
                                set_minmax_property(sql, e, PROP_MAX, res1);
                                set_minmax_property(sql, e, PROP_MIN, res2);
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to