Changeset: 4467af0541e8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4467af0541e8
Modified Files:
        monetdb5/mal/mal_runtime.c
        sql/server/rel_optimizer.c
Branch: scatter
Log Message:

Merged with Jul2021


diffs (175 lines):

diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -504,6 +504,7 @@ str runMALsequence(Client cntxt, MalBlkP
                runtimeProfileBegin(cntxt, mb, stk, getInstrPtr(mb,0), 
&runtimeProfileFunction);
                mb->starttime = GDKusec();
                if (cntxt->sessiontimeout && mb->starttime - cntxt->session > 
cntxt->sessiontimeout) {
+                       runtimeProfileFinish(cntxt, mb, stk);
                        if ( backup != backups) GDKfree(backup);
                        if ( garbage != garbages) GDKfree(garbage);
                        throw(MAL, "mal.interpreter", SQLSTATE(HYT00) 
RUNTIME_SESSION_TIMEOUT);
diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c
--- a/monetdb5/mal/mal_runtime.c
+++ b/monetdb5/mal/mal_runtime.c
@@ -161,25 +161,28 @@ clearQRYqueue(size_t idx)
 static void
 advanceQRYqueue(void)
 {
-       qhead++;
-       if( qhead == qsize)
-               qhead = 0;
-       if( qtail == qhead)
-               qtail++;
-       if( qtail == qsize)
-               qtail = 0;
-       /* clean out the element */
-       str s = QRYqueue[qhead].query;
-       if( s){
-               /* don;t wipe them when they are still running, prepared, or 
paused */
-               /* The upper layer has assured there is at least one slot 
available */
-               if(QRYqueue[qhead].status != 0 && (QRYqueue[qhead].status[0] == 
'r' || QRYqueue[qhead].status[0] == 'p')){
-                       advanceQRYqueue();
-                       return;
+       bool found_empty_slot = false;
+
+       while (!found_empty_slot) {
+               qhead++;
+               if( qhead == qsize)
+                       qhead = 0;
+               if( qtail == qhead)
+                       qtail++;
+               if( qtail == qsize)
+                       qtail = 0;
+               /* clean out the element */
+               str s = QRYqueue[qhead].query;
+               if (!s || QRYqueue[qhead].status == 0 || 
(QRYqueue[qhead].status[0] != 'r' && QRYqueue[qhead].status[0] != 'p')) {
+                       /* don't wipe them when they are still running, 
prepared, or paused */
+                       /* The upper layer has assured there is at least one 
slot available */
+                       if (s) {
+                               GDKfree(s);
+                               GDKfree(QRYqueue[qhead].username);
+                               clearQRYqueue(qhead);
+                       }
+                       found_empty_slot = true;
                }
-               GDKfree(s);
-               GDKfree(QRYqueue[qhead].username);
-               clearQRYqueue(qhead);
        }
 }
 
diff --git a/monetdb5/modules/kernel/batstr.c b/monetdb5/modules/kernel/batstr.c
--- a/monetdb5/modules/kernel/batstr.c
+++ b/monetdb5/modules/kernel/batstr.c
@@ -191,7 +191,7 @@ STRbatAscii(Client cntxt, MalBlkPtr mb, 
 
                        if ((msg = str_wchr_at(&next, x, 0)) != MAL_SUCCEED)
                                goto bailout;
-                       vals[p1] = next;
+                       vals[i] = next;
                        nils |= is_int_nil(next);
                }
        } else {
@@ -201,7 +201,7 @@ STRbatAscii(Client cntxt, MalBlkPtr mb, 
 
                        if ((msg = str_wchr_at(&next, x, 0)) != MAL_SUCCEED)
                                goto bailout;
-                       vals[p1] = next;
+                       vals[i] = next;
                        nils |= is_int_nil(next);
                }
        }
diff --git a/sql/test/SQLancer/Tests/sqlancer15.test 
b/sql/test/SQLancer/Tests/sqlancer15.test
--- a/sql/test/SQLancer/Tests/sqlancer15.test
+++ b/sql/test/SQLancer/Tests/sqlancer15.test
@@ -708,6 +708,65 @@ statement ok
 START TRANSACTION
 
 statement ok
+CREATE TABLE "t0" ("c0" CHARACTER LARGE OBJECT,"c2" DOUBLE)
+
+statement ok rowcount 20
+COPY 20 RECORDS INTO "t0" FROM stdin USING DELIMITERS E'\t',E'\n','"'
+<COPY_INTO_DATA>
+"1970" NULL
+"3"    NULL
+NULL   NULL
+"3"    NULL
+"W"    NULL
+"-"    NULL
+"t "   NULL
+"0.1454211084558179"   NULL
+"2"    NULL
+""     0.18341645025687223
+NULL   0.5805338105211456
+NULL   1810425471
+NULL   NULL
+NULL   0.8204238200689035
+"Lxy}" NULL
+"-887573436"   NULL
+NULL   0.6211363
+NULL   0.6211363
+"0.21185164"   NULL
+"0.36241230481890585"  NULL
+
+query I rowsort
+SELECT CASE WHEN t0.c2 = t0.c2 THEN 1 ELSE ascii(t0.c0) END FROM t0 LEFT OUTER 
JOIN (VALUES (1), (1), (- 81524669)) AS sub0 ON 1 <= t0.c2
+----
+1
+1
+1
+1
+1
+1
+1
+1
+116
+45
+45
+48
+48
+48
+49
+50
+51
+51
+76
+87
+NULL
+NULL
+
+statement ok
+ROLLBACK
+
+statement ok
+START TRANSACTION
+
+statement ok
 CREATE TABLE t0(c0 DOUBLE UNIQUE, c1 CHAR(224), c4 boolean)
 
 statement ok
diff --git a/sql/test/merge-partitions/Tests/mergepart31.test 
b/sql/test/merge-partitions/Tests/mergepart31.test
--- a/sql/test/merge-partitions/Tests/mergepart31.test
+++ b/sql/test/merge-partitions/Tests/mergepart31.test
@@ -368,7 +368,7 @@ CREATE TABLE fourth_decade (stamp TIMEST
 statement ok
 ALTER TABLE splitted ADD TABLE fourth_decade AS PARTITION FROM RANGE MINVALUE 
TO TIMESTAMP '2000-01-01 00:00:00'
 
-statement ok rowcount 0
+statement ok rowcount 1
 INSERT INTO splitted VALUES (TIMESTAMP '1999-01-01 00:00:00', 7)
 
 query T nosort
diff --git a/testing/sqllogictest.py b/testing/sqllogictest.py
--- a/testing/sqllogictest.py
+++ b/testing/sqllogictest.py
@@ -262,7 +262,7 @@ class SQLLogic:
         else:
             result = ['statement', 'ok']
             if expectok:
-                if expected_rowcount:
+                if expected_rowcount is not None:
                     result.append('rowcount')
                     result.append('{}'.format(affected_rowcount))
                     if expected_rowcount != affected_rowcount:
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to