Changeset: e15c4b4f2e60 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e15c4b4f2e60
Branch: default
Log Message:

Merge with Aug2024 branch.


diffs (178 lines):

diff --git a/gdk/gdk_calc_private.h b/gdk/gdk_calc_private.h
--- a/gdk/gdk_calc_private.h
+++ b/gdk/gdk_calc_private.h
@@ -121,7 +121,7 @@
 #define MUL4_WITH_CHECK(lft, rgt, TYPE3, dst, max, TYPE4, on_overflow) \
        do {                                                            \
                TYPE4 c = (TYPE4) (lft) * (rgt);                        \
-               if (c < (TYPE4) -(max) /*|| c > (TYPE4) (max)*/) {      \
+               if (c < (TYPE4) -(max) || c > (TYPE4) (max)) {          \
                        on_overflow;                                    \
                } else {                                                \
                        (dst) = (TYPE3) c;                              \
@@ -132,12 +132,11 @@
 /* integer version using Gnu CC builtin function for overflow check */
 #define MULI4_WITH_CHECK(lft, rgt, TYPE3, dst, max, TYPE4, on_overflow) \
        OP_WITH_CHECK(lft, rgt, dst, mul, max, on_overflow)
-#define LNGMUL_CHECK(lft, rgt, dst, max, on_overflow)                  \
-       OP_WITH_CHECK(lft, rgt, dst, mul, max, on_overflow)
 #else
 /* integer version using generic version */
 #define MULI4_WITH_CHECK(lft, rgt, TYPE3, dst, max, TYPE4, on_overflow) \
        MUL4_WITH_CHECK(lft, rgt, TYPE3, dst, max, TYPE4, on_overflow)
+#endif
 #ifdef HAVE_HGE
 #define LNGMUL_CHECK(lft, rgt, dst, max, on_overflow)                  \
        MULI4_WITH_CHECK(lft, rgt, lng, dst, max, hge, on_overflow)
@@ -189,7 +188,6 @@
                }                                                       \
        } while (0)
 #endif /* HAVE_HGE */
-#endif
 #define MULF4_WITH_CHECK(lft, rgt, TYPE3, dst, max, TYPE4, on_overflow) \
        MUL4_WITH_CHECK(lft, rgt, TYPE3, dst, max, TYPE4, on_overflow)
 
diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -304,6 +304,7 @@ RMTconnectScen(str *ret,
                /* we support hge, and for remote, we don't know */
                msg = RMTquery(&hdl, "remote.connect", m, "x := 0:hge;");
                if (msg) {
+                       freeException(msg);
                        c->int128 = false;
                } else {
                        mapi_close_handle(hdl);
diff --git a/sql/test/BugTracker-2014/Tests/round.Bug-3542.py 
b/sql/test/BugTracker-2014/Tests/round.Bug-3542.test
rename from sql/test/BugTracker-2014/Tests/round.Bug-3542.py
rename to sql/test/BugTracker-2014/Tests/round.Bug-3542.test
--- a/sql/test/BugTracker-2014/Tests/round.Bug-3542.py
+++ b/sql/test/BugTracker-2014/Tests/round.Bug-3542.test
@@ -1,64 +1,69 @@
-import sys, os, pymonetdb
-from decimal import Decimal
+statement ok
+CREATE TABLE test_num_data (id integer, val numeric(18,10))
+
+statement ok
+INSERT INTO test_num_data VALUES (1, '-0.0'),(2, '-34338492.215397047')
 
-db = os.getenv("TSTDB")
-port = int(os.getenv("MAPIPORT"))
+query IR rowsort
+SELECT * FROM test_num_data
+----
+1
+0.000
+2
+-34338492.215
 
-conn1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='monetdb', password='monetdb')
-cur1 = conn1.cursor()
-try:
-    cur1.execute('select cast(1 as hugeint)')
-    has_huge = True
-except pymonetdb.DatabaseError as e:
-    has_huge = False
+onlyif has-hugeint
+query IIR rowsort
+SELECT t1.id, t2.id, t1.val * t2.val FROM test_num_data t1, test_num_data t2
+----
+1
+1
+0.000
+1
+2
+0.000
+2
+1
+0.000
+2
+2
+1179132047626883.500
 
-cur1.execute("""
-CREATE TABLE test_num_data (id integer, val numeric(18,10));
-INSERT INTO test_num_data VALUES (1, '-0.0'),(2, '-34338492.215397047');
-""")
+skipif has-hugeint
+statement error 22003!overflow in calculation ...
+SELECT t1.id, t2.id, t1.val * t2.val FROM test_num_data t1, test_num_data t2
 
-cur1.execute("SELECT * FROM test_num_data;")
-if cur1.fetchall() != [(1, Decimal('0E-10')), (2, 
Decimal('-34338492.2153970470'))]:
-    sys.stderr.write('[(1, Decimal(\'0E-10\')), (2, 
Decimal(\'-34338492.2153970470\'))] expected\n')
-try:
-    cur1.execute("SELECT t1.id, t2.id, t1.val * t2.val FROM test_num_data t1, 
test_num_data t2;")
-    if has_huge:
-        if cur1.fetchall() != [(1, 1, Decimal('0E-20')), (1, 2, 
Decimal('0E-20')), (2, 1, Decimal('0E-20')), (2, 2, 
Decimal('1179132047626883.59686213585632020900'))]:
-            sys.stderr.write('[(1, 1, Decimal(\'0E-20\')), (1, 2, 
Decimal(\'0E-20\')), (2, 1, Decimal(\'0E-20\')), (2, 2, 
Decimal(\'1179132047626883.59686213585632020900\'))] expected\n')
-    else:
-        sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-    if has_huge:
-        raise e
-    elif "overflow in calculation" not in str(e):
-        sys.stderr.write('Wrong error %s, expected overflow in calculation' % 
(str(e)))
-try:
-    cur1.execute("SELECT t1.id, t2.id, round(t1.val * t2.val, 30) FROM 
test_num_data t1, test_num_data t2;")
-    if has_huge:
-        if cur1.fetchall() != [(1, 1, Decimal('0E-20')), (1, 2, 
Decimal('0E-20')), (2, 1, Decimal('0E-20')), (2, 2, 
Decimal('1179132047626883.59686213585632020900'))]:
-            sys.stderr.write('[(1, 1, Decimal(\'0E-20\')), (1, 2, 
Decimal(\'0E-20\')), (2, 1, Decimal(\'0E-20\')), (2, 2, 
Decimal(\'1179132047626883.59686213585632020900\'))] expected\n')
-    else:
-        sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-    if has_huge:
-        raise e
-    elif "overflow in calculation" not in str(e):
-        sys.stderr.write('Wrong error %s, expected overflow in calculation' % 
(str(e)))
+onlyif has-hugeint
+query IIR rowsort
+SELECT t1.id, t2.id, round(t1.val * t2.val, 30) FROM test_num_data t1, 
test_num_data t2
+----
+1
+1
+0.000
+1
+2
+0.000
+2
+1
+0.000
+2
+2
+1179132047626883.500
 
-# This is a leftover of int128 vs no-int128 from sqlancer07 test. Leave it 
here just to not create another test
-try:
-    cur1.execute("SELECT 
CAST(((24829)+(((0.9767751031140547)*(0.7479400824095245)))) AS DOUBLE) IS 
NULL;")
-    if has_huge:
-        if cur1.fetchall() != [(False,)]:
-            sys.stderr.write('[(False,)] expected\n')
-    else:
-        sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-    if has_huge:
-        raise e
-    elif "overflow in calculation" not in str(e):
-        sys.stderr.write('Wrong error %s, expected overflow in calculation' % 
(str(e)))
+skipif has-hugeint
+statement error 22003!overflow in calculation ...
+SELECT t1.id, t2.id, round(t1.val * t2.val, 30) FROM test_num_data t1, 
test_num_data t2
 
-cur1.execute("drop table test_num_data;")
-cur1.close()
-conn1.close()
+onlyif has-hugeint
+query I rowsort
+SELECT CAST(((24829)+(((0.9767751031140547)*(0.7479400824095245)))) AS DOUBLE) 
IS NULL
+----
+0
+
+skipif has-hugeint
+statement error 22003!overflow in calculation ...
+SELECT CAST(((24829)+(((0.9767751031140547)*(0.7479400824095245)))) AS DOUBLE) 
IS NULL
+
+statement ok
+drop table test_num_data
+
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to