Changeset: f65febdaa8e0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f65febdaa8e0
Modified Files:
        gdk/gdk_analytic.h
        gdk/gdk_analytic_func.c
        sql/test/BugTracker-2026/Tests/All
Branch: default
Log Message:

Merge with Dec2025 branch.


diffs (111 lines):

diff --git a/gdk/gdk_analytic.h b/gdk/gdk_analytic.h
--- a/gdk/gdk_analytic.h
+++ b/gdk/gdk_analytic.h
@@ -69,26 +69,32 @@ gdk_export BAT *GDKanalytical_covariance
 gdk_export BAT *GDKanalytical_correlation(BAT *p, BAT *o, BAT *b1, BAT *b2, 
BAT *s, BAT *e, int tpe, int frame_type)
        __attribute__((__warn_unused_result__));
 
-#define SEGMENT_TREE_FANOUT 16 /* Segment tree fanout size. Later we could do 
experiments from it */
-#define NOTHING /* used for not used optional arguments for aggregate 
computation */
+/* Segment tree fanout size. Later we could do experiments from it */
+#define SEGMENT_TREE_FANOUT 16
+/* used for unused arguments for aggregate computation */
+#define NOTHING
 #define NOTHING_ARGS(...)      ((void) 0)
 
-/* 'segment_tree' is the tree as an array, 'levels_offset' contains the 
offsets in the tree where each level does start,
-   and 'nlevels' is the number of levels on the current segment tree.
-   In order to run in out-of-memory situations they are allocated inside a 
BAT. The 'levels_offset' are allocated after
-   the segment tree. The beginning pointers for both are returned. */
+/* 'segment_tree' is the tree as an array, 'levels_offset' contains the
+ * offsets in the tree where each level starts, and 'nlevels' is the
+ * number of levels on the current segment tree.  In order to run in
+ * out-of-memory situations they are allocated inside a Heap.  The
+ * 'levels_offset' are allocated after the segment tree.  The beginning
+ * pointers for both are returned. */
 gdk_export Heap *GDKinitialize_segment_tree(void)
        __attribute__((__warn_unused_result__));
 gdk_export gdk_return GDKrebuild_segment_tree(oid ncount, oid data_size, Heap 
*st, void **segment_tree, oid **levels_offset, oid *nlevels);
 
-/* segment_tree, levels_offset and nlevels must be already defined. ARG1, ARG2 
and ARG3 are to be used by the aggregate */
+/* segment_tree, levels_offset and nlevels must be already
+ * defined. ARG1, ARG2 and ARG3 are to be used by the aggregate */
 #define populate_segment_tree(CAST, COUNT, INIT_AGGREGATE, COMPUTE_LEVEL0, 
COMPUTE_LEVELN, COMPUTE_LEVELN_FINISH, ARG1, ARG2, ARG3) \
        do {                                                            \
                CAST *ctree = (CAST *) segment_tree;                    \
                CAST *prev_level_begin = ctree;                         \
                oid level_size = COUNT, tree_offset = 0, current_level = 0; \
                                                                        \
-               levels_offset[current_level++] = 0; /* first level is trivial 
*/ \
+               /* first level is trivial */                            \
+               levels_offset[current_level++] = 0;                     \
                for (oid pos = 0; pos < level_size; pos += SEGMENT_TREE_FANOUT) 
{ \
                        oid end = MIN(level_size, pos + SEGMENT_TREE_FANOUT); \
                                                                        \
@@ -99,7 +105,8 @@ gdk_export gdk_return GDKrebuild_segment
                        }                                               \
                }                                                       \
                                                                        \
-               while (current_level < nlevels) { /* for the following levels 
we have to use the previous level results */ \
+               /* for the following levels we have to use the previous level 
results */ \
+               while (current_level < nlevels) {                       \
                        oid prev_tree_offset = tree_offset;             \
                        levels_offset[current_level++] = tree_offset;   \
                        for (oid pos = 0; pos < level_size; pos += 
SEGMENT_TREE_FANOUT) { \
@@ -118,7 +125,8 @@ gdk_export gdk_return GDKrebuild_segment
        } while (0)
 
 #define compute_on_segment_tree(CAST, START, END, INIT_AGGREGATE, COMPUTE, 
FINALIZE_AGGREGATE, ARG1, ARG2, ARG3) \
-       do { /* taken from https://www.vldb.org/pvldb/vol8/p1058-leis.pdf */ \
+       do {                                                            \
+               /* taken from https://www.vldb.org/pvldb/vol8/p1058-leis.pdf */ 
\
                oid begin = START, tend = END;                          \
                CAST computed;                                          \
                INIT_AGGREGATE(ARG1, ARG2, ARG3);                       \
diff --git a/gdk/gdk_analytic_func.c b/gdk/gdk_analytic_func.c
--- a/gdk/gdk_analytic_func.c
+++ b/gdk/gdk_analytic_func.c
@@ -2218,11 +2218,6 @@ finishsum(allocator *ma, struct pergroup
        do {                                                    \
                if (pg.valseen) {                               \
                        double curval = finishsum(ta, &pg);     \
-                       if (isinf(curval) ||                    \
-                           isnan(curval) ||                    \
-                           curval > GDK_##TPE2##_max ||        \
-                           curval < -GDK_##TPE2##_max)         \
-                               goto calc_overflow;             \
                        computed = (TPE2) curval;               \
                }                                               \
                ma_close(&ta_state);                            \
diff --git a/sql/test/BugTracker-2026/Tests/7922-sum-overflow-error-bug.test 
b/sql/test/BugTracker-2026/Tests/7922-sum-overflow-error-bug.test
--- a/sql/test/BugTracker-2026/Tests/7922-sum-overflow-error-bug.test
+++ b/sql/test/BugTracker-2026/Tests/7922-sum-overflow-error-bug.test
@@ -30,8 +30,6 @@ INSERT INTO t_bug12_aux VALUES
   (2, 13)
 
 -- original window query
--- MonetDB returns: 22003!overflow in calculation. but other RDBMS do not.
--- the sum(t_bug12.vf) needs to add: -1e308 + -1e308 + 1e308, which apparently 
fails with overflow in calculation error, see below.
 query II nosort
 SELECT p, v
 FROM (
@@ -62,6 +60,7 @@ ORDER BY p, v
 960
 
 -- the sum(t_bug12.vf) needs to add: -1e308 + -1e308 + 1e308, which apparently 
fails with overflow in calculation error
+skipif knownfail
 query R nosort
 SELECT -1e308 + -1e308 + 1e308 as sum
 ----
diff --git a/sql/test/BugTracker-2026/Tests/All 
b/sql/test/BugTracker-2026/Tests/All
--- a/sql/test/BugTracker-2026/Tests/All
+++ b/sql/test/BugTracker-2026/Tests/All
@@ -116,7 +116,7 @@ KNOWNFAIL?7774-insert-into-renamed-table
 7919-correlated-count-distinct-bug
 7920-correlated-top-1-subquery-bug
 7921-correlated-floor-ratio-bug
-KNOWNFAIL?7922-sum-overflow-error-bug
+7922-sum-overflow-error-bug
 7923-sum-decimal-conversion-overflow-bug
 KNOWNFAIL?7924-sum-double-overflow-bug
 7925-inconsistent-compare-varchar-to-bte-bug
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to