Changeset: a020e2959e0f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a020e2959e0f
Modified Files:
        monetdb5/modules/mal/remote.c
        sql/test/SQLancer/Tests/sqlancer19.SQL.py
Branch: default
Log Message:

Don't make confusion between void and dense bats


diffs (67 lines):

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
@@ -1512,7 +1512,7 @@ static str RMTbincopyto(Client cntxt, Ma
 {
        bat bid = *getArgReference_bat(stk, pci, 1);
        BAT *b = BBPquickdesc(bid), *v = b;
-       char sendtheap = 0;
+       char sendtheap = 0, sendtvheap = 0;
 
        (void)mb;
        (void)stk;
@@ -1524,8 +1524,9 @@ static str RMTbincopyto(Client cntxt, Ma
        if (BBPfix(bid) <= 0)
                throw(MAL, "remote.bincopyto", MAL_MALLOC_FAIL);
 
-       sendtheap = !BATtvoid(b) && b->tvarsized;
-       if (isVIEW(b) && sendtheap && VIEWvtparent(b) && BATcount(b) < 
BATcount(BBP_cache(VIEWvtparent(b)))) {
+       sendtheap = b->ttype != TYPE_void;
+       sendtvheap = sendtheap && b->tvarsized;
+       if (isVIEW(b) && sendtvheap && VIEWvtparent(b) && BATcount(b) < 
BATcount(BBP_cache(VIEWvtparent(b)))) {
                if ((b = BATdescriptor(bid)) == NULL) {
                        BBPunfix(bid);
                        throw(MAL, "remote.bincopyto", RUNTIME_OBJECT_MISSING);
@@ -1559,19 +1560,19 @@ static str RMTbincopyto(Client cntxt, Ma
                        v->tnonil,
                        BATtdense(v),
                        v->batCount,
-                       BATtvoid(v) ? 0 : (size_t)v->batCount << v->tshift,
-                       sendtheap && !BATtvoid(v) && v->batCount > 0 ? 
v->tvheap->free : 0
+                       sendtheap ? (size_t)v->batCount << v->tshift : 0,
+                       sendtvheap && v->batCount > 0 ? v->tvheap->free : 0
                        );
 
-       if (!BATtvoid(v) && v->batCount > 0) {
+       if (sendtheap && v->batCount > 0) {
                BATiter vi = bat_iterator(v);
                mnstr_write(cntxt->fdout, /* tail */
                                        vi.base, vi.count * vi.width, 1);
-               if (sendtheap)
+               if (sendtvheap)
                        mnstr_write(cntxt->fdout, /* theap */
                                                vi.vh->base, vi.vhfree, 1);
                bat_iterator_end(&vi);
-       }       
+       }
        /* flush is done by the calling environment (MAL) */
 
        if (b != v)
diff --git a/sql/test/SQLancer/Tests/sqlancer19.SQL.py 
b/sql/test/SQLancer/Tests/sqlancer19.SQL.py
--- a/sql/test/SQLancer/Tests/sqlancer19.SQL.py
+++ b/sql/test/SQLancer/Tests/sqlancer19.SQL.py
@@ -212,6 +212,14 @@ with SQLTestCase() as cli:
         .assertSucceeded().assertDataResultMatch([])
     cli.execute("select 1 from (select distinct 1 from v1, t3) as v1(vc1) 
where sql_min(true, true);") \
         .assertSucceeded().assertDataResultMatch([])
+    cli.execute("SELECT count(*) FROM ((select 7 from rt3, (values (1)) y(y)) 
union (select 3)) x(x);") \
+        .assertSucceeded().assertDataResultMatch([(2,)])
+    cli.execute("SELECT count(*) FROM ((select 7 from t3, (values (1)) y(y)) 
union (select 3)) x(x);") \
+        .assertSucceeded().assertDataResultMatch([(2,)])
+    cli.execute("SELECT count(*) FROM ((select 7 from rt3, (values (1)) y(y)) 
union all (select 3)) x(x);") \
+        .assertSucceeded().assertDataResultMatch([(7,)])
+    cli.execute("SELECT count(*) FROM ((select 7 from t3, (values (1)) y(y)) 
union all (select 3)) x(x);") \
+        .assertSucceeded().assertDataResultMatch([(7,)])
     cli.execute("ROLLBACK;")
 
     cli.execute("""
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to